Why does my GUI interface get eroded while running my code???

1 次查看(过去 30 天)
I've got a new problem. When I try to run my skin extraction code in GUI, the GUI interface gets eroded. I am giving my skin extraction GUI function here. Can anybody tell me what the problem is?
% --- Executes on button press in skinextraction.
function skinextraction_Callback(hObject, eventdata, handles)
% hObject handle to skinextraction (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
fullImageFileName='shreya.jpg';
% Read in image into an array.
[rgbImage storedColorMap] = imread(fullImageFileName);
[rows columns numberOfColorBands] = size(rgbImage);
% If it's monochrome (indexed), convert it to color.
% Check to see if it's an 8-bit image needed later for scaling).
if strcmpi(class(rgbImage), 'uint8')
% Flag for 256 gray levels.
eightBit = true;
else
eightBit = false;
end
if numberOfColorBands == 1
if isempty(storedColorMap)
% Just a simple gray level image, not indexed with a stored color map.
% Create a 3D true color image where we copy the monochrome image into all 3 (R, G, & B) color planes.
rgbImage = cat(3, rgbImage, rgbImage, rgbImage);
else
% It's an indexed image.
rgbImage = ind2rgb(rgbImage, storedColorMap);
% ind2rgb() will convert it to double and normalize it to the range 0-1.
% Convert back to uint8 in the range 0-255, if needed.
if eightBit
rgbImage = uint8(255 * rgbImage);
end
end
end
% Convert RGB image to HSV
hsvImage = rgb2hsv(rgbImage);
% Extract out the H, S, and V images individually
hImage = hsvImage(:,:,1);
sImage = hsvImage(:,:,2);
vImage = hsvImage(:,:,3);
% Compute and plot the histogram of the "hue" band.
%hHuePlot = subplot(3, 4, 6);
[hueCounts, hueBinValues] = imhist(hImage);
maxHueBinValue = find(hueCounts > 0, 1, 'last');
maxCountHue = max(hueCounts);
%bar(hueBinValues, hueCounts, 'r');
grid on;
% Compute and plot the histogram of the "saturation" band.
[saturationCounts, saturationBinValues] = imhist(sImage);
maxSaturationBinValue = find(saturationCounts > 0, 1, 'last');
maxCountSaturation = max(saturationCounts);
[valueCounts, valueBinValues] = imhist(vImage);
maxValueBinValue = find(valueCounts > 0, 1, 'last');
maxCountValue = max(valueCounts);
maxGrayLevel = max([maxHueBinValue, maxSaturationBinValue, maxValueBinValue]);
% Assign the low and high thresholds for each color band.
% Take a guess at the values that might work for the user's image.
hueThresholdLow = 0;
hueThresholdHigh = graythresh(hImage);
saturationThresholdLow = graythresh(sImage);
saturationThresholdHigh = 1.0;
valueThresholdLow = graythresh(vImage);
valueThresholdHigh = 1.0;
% Now apply each color band's particular thresholds to the color band
hueMask = (hImage >= hueThresholdLow) & (hImage <= hueThresholdHigh);
saturationMask = (sImage >= saturationThresholdLow) & (sImage <= saturationThresholdHigh);
valueMask = (vImage >= valueThresholdLow) & (vImage <= valueThresholdHigh);
% Display the thresholded binary images.
yellowObjectsMask = uint8(hueMask & saturationMask & valueMask);
smallestAcceptableArea = 100; % Keep areas only if they're bigger than this.
% Get rid of small objects. Note: bwareaopen returns a logical.
yellowObjectsMask = uint8(bwareaopen(yellowObjectsMask, smallestAcceptableArea));
% Smooth the border using a morphological closing operation, imclose().
structuringElement = strel('disk', 4);
yellowObjectsMask = imclose(yellowObjectsMask, structuringElement);
% Fill in any holes in the regions, since they are most likely red also.
yellowObjectsMask = uint8(imfill(yellowObjectsMask, 'holes'));
figure;imshow(yellowObjectsMask, []);
export_fig(gcf, 'temp/pred_prey.jpg');
PLEASE HAVE A LOOK AT THIS SCREENSHOT TO KNOW WHAT I ACTUALLY MEAN
https://picasaweb.google.com/lh/photo/HKIUk-MFuRIs5LzW__70SpOzMXS1UfqXPDW9N1lFu0w?feat=directlink
https://picasaweb.google.com/lh/photo/g_Zr_U-7W-Fpv8jFEQOng5OzMXS1UfqXPDW9N1lFu0w?feat=directlink
  1 个评论
Jan
Jan 2011-2-24
Please explain the problem with any details. Just showing two pictures does not really help.

请先登录,再进行评论。

采纳的回答

Jan
Jan 2011-2-24
I'm not sure, what your problem exactly is. But I guess you do not want the AXES object appear in your GUI. Then:
Omit the "grid on;"
A general method to inspect such problems is setting a breakpoint in the code and use the debugger to step through the program line by line. Then you will immediately see, which line causes the problem.

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by