Image Processing
Ältere Kommentare anzeigen
Hi 2 all,
I have one formula for finding moments But i could not know how to proceed further i.e) how to write matlab code for this.Anyone can clarify this? Please send ur suggestion....
imagemoment=summation(imagepixel(i,j)*(x-x')2) / summation(imagepixel(i,j))
summation will be perfformed from 1 to 8
My code:
im=imread('image.jpg'); %binary image of 256x256
u1=xcos(0)+ysin(0);
for i=1:256
for j=1:256
for k=1:8
for l=1:8
sigma(k,l)=im(k,l)*u1; %doubtful statement
end
end
end
end
%here sigma value must be the summation of 64 values that means in x axis 8 values and y axis 8 values(8x8 block) How to perform this cumulative addition Please post how to perform basic summation Thx in advance........
im1=
x=1 to 8
x'=summation(imagepixel*x) / summation(image pixel)
i,j varies from 1 to 8
13 Kommentare
Jan
am 14 Sep. 2011
@Jana: Please post at least a pseudo-code. It is not clear, where the "i,j varies from 1 to 8" should be applied.
harjan
am 15 Sep. 2011
Jan
am 15 Sep. 2011
@Jana: Please show, what you have done so far and post either Matlab or pseudo-code. It is your turn to make it as clear as possible, what you want to calculate. "Summation will be form i to j (1 to 8)" is simply cryptic. Therefore suggesting any implementations would be wild guessing only. Of course it is possible to guess, what you could need.
Please edit your original question and insert the algorithm in a meaningful notation (ask WikiPedia for "pseudo-code"). Then define the imputs exactly, e.g. "imagepixel" could be a be DOUBLE or UINT8.
harjan
am 17 Sep. 2011
Jan
am 18 Sep. 2011
@Jana: I'm not a native speaker and parsing your message is very hard for me. I'd appreciate, if you try to use proper English. Thanks.
Image Analyst
am 18 Sep. 2011
Even for a native English speaker like me it appears as gibberish, and takes twice as long to figure out what she means than if she had just written in standard English.
harjan
am 19 Sep. 2011
Jan
am 19 Sep. 2011
@Jana: "Sorry for the inconvenience" on one hand, but a repetition of "k Let i explain my qn clearly " on the other. This is not funny, nor fancy nor efficient - this is simply hard to read. Obviously you are not interested in my assistence. Perhaps there are enough others who like this slang. Good luck.
@Image Analyst: I'm not using standard English also, but I really try to get as near as I can.
harjan
am 19 Sep. 2011
Image Analyst
am 19 Sep. 2011
Then don't use words not in the dictionary such as ur, qn, ll, k, thx, etc. In other words, you're using a computer with a real keyboard, not a cell phone, so use the keyboard. That's what it's there for.
How many moments do you need? Is there any reason why you're not using mean(), std(), and var()? Do you need moments higher than 2? If so, why? I've rarely, if ever, found that I needed some higher moment to do anything meaningful.
harjan
am 20 Sep. 2011
Jan
am 20 Sep. 2011
Please write a comment to proecsm's answer. Does it solve your problem? If not, why? What modifications are needed?
harjan
am 20 Sep. 2011
Akzeptierte Antwort
Weitere Antworten (1)
heba ahmed
am 23 Feb. 2020
0 Stimmen
b=uint8(zeros(256,256));
>> [i j]=size(b);
>> for i=1:256 for j=1:256 b(i,j)=i;
end
end
>> imshow(b,[8]);
Kategorien
Mehr zu Image Arithmetic finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!