From: Zanie on
Hi...

I want to extract some specific portion from the image. I tried but unable to do.
Can any one help me. Here is my code;

%% Blobs analysis
[Ilabel num] = bwlabel(Image);

Iprops = regionprops(Ilabel);
Ibox = [Iprops.BoundingBox];
Ibox = reshape(Ibox,[4, num]);

%% Plot the Object Location
hold on;

%% Extract the portion

for cnt = 1:num
alpha= rectangle('position',Ibox(:,cnt),'edgecolor','g');
cur= img(Ibox(:,cnt)); % img is the original image
subplot(2,1,2); imshow(cur);
pause(0.5);
end

The image has been converted into gray scale and then into blackWhite. Morphology process has done and then Blob Analysis.
In this example(http://www.flickr.com/photos/47557774(a)N08/4352072790/)
i want to extract alphabet 'A' which is surrounded by green rectangle box,(Extract the portion from original image(img)) and store that image in 'cur'. Show the extract portion and then next alphabet i.e. 'B' will be surrounded by rectangle and save into 'cur'.
The my output is shown in the picture, only white box is appear.
Can any one help me..

Thanks in advance.
From: ImageAnalyst on
Why not try imcrop()?
From: Rami AbouSleiman on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <b16b1cba-fad3-4be5-9123-ccfd7a54ba4d(a)k41g2000yqm.googlegroups.com>...
> Why not try imcrop()?


use bit selection as if I is your image do this:

I=I(1:600, 1:500)
From: Zanie on
thanx
this work is done!!!

but little more help is required

how do i use the four elements of the rectangle separately like in c# we use

suppose two rectangle 1st is prev and 2nd is curr

if (prev.miny>curr.minx)
etc..

in matlab how do i use

in this code i want to create 1 dummy array prev that later on replaces by the rectangles formed;

----------------------------------------------------------
prev=[ 1,1,1,1];
maxx=2; maxy=2;
for cnt = 1:num
lig= rectangle('position',Ibox(:,cnt),'edgecolor','g');
cur= imcrop(img,Ibox(:,cnt));
cur.maxx=minx+width;
cur.maxy=miny+height;
if(prev.minx>cur.minx) & (prev.maxy<cur.maxy)
newRect=rectangle('position',[cur.minx,prev.miny,cur.width,maxy-miny],'edgecolor','g');

current=imcrop(newRect);

subplot(5,1,4); imshow(current);
pause(0.5);

end
----------------------------------------------------

how do i write these code in matlab????
From: ImageAnalyst on
Post something that will actually run. Use a standard MATLAB demo
image. I don't want to write a bunch of code that you already have
just to get it to the starting point. So post your full code.
 |  Next  |  Last
Pages: 1 2
Prev: Minimizing an Integral function
Next: image matrix