Removing rogue spatial frequencies from and image












0















I am currently working through an exercise and am at lost to how to remove the rouge pixels or as the question implies change them to a different colour I believe.



Here is the question, I have screen capture so no misspelling are made.




Q part 1
Q part 2




So here is my code so far



    A=imread('coins.png');
x=1:size(A,2); y=1:size(A,1); [X,Y]=meshgrid(x,y);
noise= 30.*cos(2.*pi.*X./15 + 2.*pi.*Y./20);
B=double(A) + noise;
%subplot(1,2,1), imshow(A)
%subplot(1,2,2), imagesc(B); axis image; axis image;

D = fftshift(fft2(B));

E=imagesc(log(abs(D)));colormap gray

plot(abs(D))


Plot of frequency



As you can see from my plot there are two peak next to the central peak, these are the peak that I have to remove. But my issue I cant figure a way on how to implement my idea.



My idea is that if I take the central value and the two end point of each peak and find the row and column I can set it to zero and run it in a loop which will zero out all the element in the peaks, the issue is I cant figure a way into implementing this in a loop or if statement and wondering if someone could maybe advise and guide me though.










share|improve this question

























  • I did try to change the from RGB to grey using RGB2grey(E) but I got an error the only other way round was to use imagesc(...;colormap grey) but to me that only displays the image in grey not change it.

    – james2018
    Nov 15 '18 at 11:35
















0















I am currently working through an exercise and am at lost to how to remove the rouge pixels or as the question implies change them to a different colour I believe.



Here is the question, I have screen capture so no misspelling are made.




Q part 1
Q part 2




So here is my code so far



    A=imread('coins.png');
x=1:size(A,2); y=1:size(A,1); [X,Y]=meshgrid(x,y);
noise= 30.*cos(2.*pi.*X./15 + 2.*pi.*Y./20);
B=double(A) + noise;
%subplot(1,2,1), imshow(A)
%subplot(1,2,2), imagesc(B); axis image; axis image;

D = fftshift(fft2(B));

E=imagesc(log(abs(D)));colormap gray

plot(abs(D))


Plot of frequency



As you can see from my plot there are two peak next to the central peak, these are the peak that I have to remove. But my issue I cant figure a way on how to implement my idea.



My idea is that if I take the central value and the two end point of each peak and find the row and column I can set it to zero and run it in a loop which will zero out all the element in the peaks, the issue is I cant figure a way into implementing this in a loop or if statement and wondering if someone could maybe advise and guide me though.










share|improve this question

























  • I did try to change the from RGB to grey using RGB2grey(E) but I got an error the only other way round was to use imagesc(...;colormap grey) but to me that only displays the image in grey not change it.

    – james2018
    Nov 15 '18 at 11:35














0












0








0








I am currently working through an exercise and am at lost to how to remove the rouge pixels or as the question implies change them to a different colour I believe.



Here is the question, I have screen capture so no misspelling are made.




Q part 1
Q part 2




So here is my code so far



    A=imread('coins.png');
x=1:size(A,2); y=1:size(A,1); [X,Y]=meshgrid(x,y);
noise= 30.*cos(2.*pi.*X./15 + 2.*pi.*Y./20);
B=double(A) + noise;
%subplot(1,2,1), imshow(A)
%subplot(1,2,2), imagesc(B); axis image; axis image;

D = fftshift(fft2(B));

E=imagesc(log(abs(D)));colormap gray

plot(abs(D))


Plot of frequency



As you can see from my plot there are two peak next to the central peak, these are the peak that I have to remove. But my issue I cant figure a way on how to implement my idea.



My idea is that if I take the central value and the two end point of each peak and find the row and column I can set it to zero and run it in a loop which will zero out all the element in the peaks, the issue is I cant figure a way into implementing this in a loop or if statement and wondering if someone could maybe advise and guide me though.










share|improve this question
















I am currently working through an exercise and am at lost to how to remove the rouge pixels or as the question implies change them to a different colour I believe.



Here is the question, I have screen capture so no misspelling are made.




Q part 1
Q part 2




So here is my code so far



    A=imread('coins.png');
x=1:size(A,2); y=1:size(A,1); [X,Y]=meshgrid(x,y);
noise= 30.*cos(2.*pi.*X./15 + 2.*pi.*Y./20);
B=double(A) + noise;
%subplot(1,2,1), imshow(A)
%subplot(1,2,2), imagesc(B); axis image; axis image;

D = fftshift(fft2(B));

E=imagesc(log(abs(D)));colormap gray

plot(abs(D))


Plot of frequency



As you can see from my plot there are two peak next to the central peak, these are the peak that I have to remove. But my issue I cant figure a way on how to implement my idea.



My idea is that if I take the central value and the two end point of each peak and find the row and column I can set it to zero and run it in a loop which will zero out all the element in the peaks, the issue is I cant figure a way into implementing this in a loop or if statement and wondering if someone could maybe advise and guide me though.







matlab image-processing matlab-figure






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 5 at 21:24









marc_s

573k12811071255




573k12811071255










asked Nov 14 '18 at 20:54









james2018james2018

32




32













  • I did try to change the from RGB to grey using RGB2grey(E) but I got an error the only other way round was to use imagesc(...;colormap grey) but to me that only displays the image in grey not change it.

    – james2018
    Nov 15 '18 at 11:35



















  • I did try to change the from RGB to grey using RGB2grey(E) but I got an error the only other way round was to use imagesc(...;colormap grey) but to me that only displays the image in grey not change it.

    – james2018
    Nov 15 '18 at 11:35

















I did try to change the from RGB to grey using RGB2grey(E) but I got an error the only other way round was to use imagesc(...;colormap grey) but to me that only displays the image in grey not change it.

– james2018
Nov 15 '18 at 11:35





I did try to change the from RGB to grey using RGB2grey(E) but I got an error the only other way round was to use imagesc(...;colormap grey) but to me that only displays the image in grey not change it.

– james2018
Nov 15 '18 at 11:35












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53308568%2fremoving-rogue-spatial-frequencies-from-and-image%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53308568%2fremoving-rogue-spatial-frequencies-from-and-image%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini