unknown image format on axes in MATLAB

1 visualización (últimos 30 días)
Chethan
Chethan el 3 de Mayo de 2013
I'm working on CBIR, in my GUI I've 6 axes one for query image 5 for resulted images. For displaying images on axes my code is
function displayResults(filename,hObject, eventdata, handles)
% Open 'filename' file... for reading...
fid = fopen(filename);
for N=6:1:10
imagename = fgetl(fid);
if ~ischar(imagename), break, end % Meaning: End of File...
x=imread(imagename);
axes(handles.(sprintf('axes%d', N)));
imshow(x)
xlabel(imagename);
end
fclose(fid);
and calling function is in pushbutton function Texture_Callback(hObject, eventdata, handles). calling function is
displayResults('textureResults.txt',hObject, eventdata, handles);
What just happened to image quality?
Before using above code i was getting clear images, but that was not a GUI window, instead just a figure window. any thing wrong in called function?
  5 comentarios
Chethan
Chethan el 4 de Mayo de 2013
well, that resulted in same output. As you said i added hold(ax, 'off') after the assignment to "ax" i.e., above image(x, 'Parent', ax);. . and it didn't work. How can i remove those map values(x and y axis values)?
Image Analyst
Image Analyst el 4 de Mayo de 2013
Not sure what "map values(x and y axis values)" are - I didn't see any axis values or tick marks, but if you have some there now, just say "axis off" to get rid of them. If you have a colorbar, you can say
colormap(gray(256));
colorbar off;
to get rid of the colorbar and go back to a normal display.

Iniciar sesión para comentar.

Respuestas (1)

Image Analyst
Image Analyst el 4 de Mayo de 2013
Can you plot the histogram in one of those axes so I can look at it. Here's a snippet of code:
% Let's compute and display the histogram.
[pixelCount, grayLevels] = imhist(grayImage);
bar(pixelCount);
grid on;
title('Histogram of original image', 'FontSize', fontSize);
xlim([0 grayLevels(end)]); % Scale x axis manually.
Then see if the histogram (pixelCount) ends around mid-100s and then is all zeros until there is a big spike at element #256.
  13 comentarios
Image Analyst
Image Analyst el 5 de Mayo de 2013
Why did you do that? Why did you not use grayscale? (They were saved as PNG, which is good though, better than BMP, so at least you did something right.)
Chethan
Chethan el 5 de Mayo de 2013
Anyways finally i got good clarity output. simply i changed final image to RGB, then i displayed
[x,map]=imread(imagename);
rgb=ind2rgb(x,map);
ax = handles.(sprintf('axes%d', N));
hold(ax, 'off');
image(rgb, 'Parent', ax);
Thank you for your guidance.

Iniciar sesión para comentar.

Categorías

Más información sobre Images en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by