Error in output image
2 views (last 30 days)
Show older comments
I have a image converted to quanterion form,now i have performed some operation on that code
My code is
A = imread('peppers.png');
qlena = convert(quaternion(lena(:,:,1), ...
lena(:,:,3)), 'double') ./ 256;
[minsum, minidx] = min( sum(abs(repmat(q(:),1,9)-repmat(q(:).',9,1))));
S=min(abs(([V1 V2 V3 V4])));
temp = convert(qVFM.* 256, 'uint8');
edge = zeros(size(temp, 1), size(temp, 2), size(temp, 3), 'uint8');
edge(:,:,1) = x(temp);
edge(:,:,2) = y(temp);
edge(:,:,3) = z(temp);
my final output is not a peppers image,it chows some blocks with different colours please help
Walter Roberson on 22 Dec 2012
Edited: Walter Roberson on 22 Dec 2012
You overwrite qVFM within the loop, not using its value until you exit the loop. Is that really what you want to do ?
Image Analyst on 24 Dec 2012
Edited: Image Analyst on 24 Dec 2012
And what are i and j looping over? The window? Where are the loops over rows and columns of the entire image? A sliding window type of filter has 4 nested for loops, not two. Which array is your output image? Why do i and j only go from 2 to 6? This is just a 5 by 5 patch in the upper left corner of your image. That's just a window. Is the window supposed to scan around the entire image? If so, again, where are the loops over rows and columns?
DON'T USE EDGE as the name of your variable since that is a built-in function name.
Why do you set qVFM equal to one single element of q if S>T, but if S<=T you set qVFM equal to the whole multi-element q matrix? What is qVFM supposed to be? Is it a single number or an entire 3x3 array???
Why do you initialize qVFM to minsum when you overwrite it later and never ever use it as that value. It can't have that value - well it can but it's never used because it's immediately overwritten.
Since you display edge (which is your image now that you've destroyed the "edge" function) it appears to be your output image, but you never say edge(row, column) = qVFM!!! In fact you set edge equal to x, y, and z but you never initialized those arrays, at least that you showed us. How does this thing even run? It should throw an exception when it tries to assign x to edge.
The whole code is just a mess and I suggest you undertake a thoughtful re-write. Perhaps adding some comments will guide you to making the proper lines of code.
Finally, "chows" means "eats" especially in a hurry or a great volume of food, as in "He really chows down those peppers like there's no tomorrow!"
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!