How do i crop an image (delete the background)
이전 댓글 표시
I m new to Matlab but here is what I'm trying to do. Here is the original image https://picasaweb.google.com/117741942742967044268/MatlabTests#5715055956158535938
i'm trying to crop the box. is it possible that i crop this using a binary image like this? https://picasaweb.google.com/117741942742967044268/MatlabTests#5715056388429220994
if yes, but the mask is still not very clear. there are some black pixels inside the white area. how can i superfine it?
here is the code to generate the binary image from rgbImage:
% Convert image from RGB colorspace to lab color space.
cform = makecform('srgb2lab');
lab_Image = applycform(im2double(rgbImage),cform);
% Extract out the color bands from the original image
% into 3 separate 2D arrays, one for each color component.
LChannel = lab_Image(:, :, 1);
aChannel = lab_Image(:, :, 2);
bChannel = lab_Image(:, :, 3);
%Convert aChannel(double) to unit8 RGB image
aChannelToRgb8 = repmat (uint8(255.*aChannel),[1 1 3]);
%multiply the original rgb image with aChannelToRgb8
multiplyResult = immultiply (rgbImage,aChannelToRgb8);
%convert multiplyResult to binary with a level
BW = im2bw (multiplyResult, 0.4);
imshow (BW);
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!