<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: bwlabel search order</title>
	<link>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/</link>
	<description>Steve Eddins manages the Image &#38; Geospatial development team at &#60;a href="http://www.mathworks.com/"&#62;The MathWorks&#60;/a&#62; and coauthored &#60;a href="http://www.mathworks.com/support/books/book5291.html?category=-1&#38;language=-1"&#62;Digital Image Processing Using MATLAB&#60;/a&#62;. He writes here about image processing concepts, algorithm implementations, and MATLAB.&#60;br&#62;&#60;br&#62;&#60;img&#62;</description>
	<pubDate>Mon, 23 Nov 2009 01:00:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21911</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Wed, 24 Jun 2009 14:39:45 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21911</guid>
		<description>John&#8212;Thanks for the tip.</description>
		<content:encoded><![CDATA[<p>John&mdash;Thanks for the tip.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21910</link>
		<dc:creator>John</dc:creator>
		<pubDate>Wed, 24 Jun 2009 14:33:20 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21910</guid>
		<description>One trick I have used is a template match...for example if the text is a fixed space font, I know where possible character centers will be and I match the connected component to the nearest possible location. This way the object is identified in a postion I expect it to be in and allows me to "track" objects in a series of images as long as they don't move too far. If an object is missing at a location, I just skip that component label...if two objects appear close to the same location, I can consider if these are one object that is broken. This obviously has problems if spacing is real tight and/or the template is offset too much. In most cases I use a VERY good image to automatically build the template for future images</description>
		<content:encoded><![CDATA[<p>One trick I have used is a template match&#8230;for example if the text is a fixed space font, I know where possible character centers will be and I match the connected component to the nearest possible location. This way the object is identified in a postion I expect it to be in and allows me to &#8220;track&#8221; objects in a series of images as long as they don&#8217;t move too far. If an object is missing at a location, I just skip that component label&#8230;if two objects appear close to the same location, I can consider if these are one object that is broken. This obviously has problems if spacing is real tight and/or the template is offset too much. In most cases I use a VERY good image to automatically build the template for future images</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21849</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 09 Jun 2009 14:51:58 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21849</guid>
		<description>u1ukbek&#8212;Pass your binary image directly to regionprops. Use the bounding box parameters to compute the first and low rows and columns and then use ordinary MATLAB array indexing to extract the subimage.</description>
		<content:encoded><![CDATA[<p>u1ukbek&mdash;Pass your binary image directly to regionprops. Use the bounding box parameters to compute the first and low rows and columns and then use ordinary MATLAB array indexing to extract the subimage.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: u1ukbek</title>
		<link>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21846</link>
		<dc:creator>u1ukbek</dc:creator>
		<pubDate>Tue, 09 Jun 2009 11:49:59 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21846</guid>
		<description>Hello,

How to take BoundingBox of all objects as single object. Then want to crop region by using BoundingBox parameters.

Thanks</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>How to take BoundingBox of all objects as single object. Then want to crop region by using BoundingBox parameters.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ioan Buciu</title>
		<link>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21677</link>
		<dc:creator>Ioan Buciu</dc:creator>
		<pubDate>Mon, 13 Apr 2009 08:53:51 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21677</guid>
		<description>Hi all,

there is a simply way of scanning the image along the rows using bwlabel. The idea is to separate the characters along the rows and eliminate the line space amongst the rows and then take one row at the time. Of course, this only works when there is no connection between the text rows. Below is one example:

&lt;pre&gt;
url = 'http://blogs.mathworks.com/images/steve/186/scanned_page.png';
bw = imread(url);
bw = ~bw(1107:1194, 17:135);
imshow(bw)
% Initialize
WP = 1:size(bw,1);
% Assign 0 to the lines between characters
% and 1 to the lines filled with characters
for i = 1:size(bw,1)
    l = length(find(bw(i,:) == 0));
    if (l == size(bw,2))
        WP(i) = 0;
    else
        WP(i) = 1;
    end
end
% Find and separate the image in row-character-blocks 
startofblock = strfind(WP, [0,1]);
endofblock = strfind(WP,[1,0]);
statistics = [];
for i = 1:size(startofblock,2)
    subplot(5,2,i);
    imshow(bw(startofblock(i)+1:endofblock(i),:))
    stats = regionprops(bwlabel(bw(startofblock(i)+1:endofblock(i),:)),'Image');
    statistics = cat(1, statistics, stats);
end
&lt;/pre&gt;

The only problem is that we have 20 characters instead of 19. More precisely, two caracters ("a" and "r" are viewed as one connected character "ar" as they are actually connected. On the other hand there are 2 characters that are disconnected (see "f" and "a" from the last line). However, this is another story and you can use some other algorithms for segmentation and character connection before segmentation.

Best regards,

IB</description>
		<content:encoded><![CDATA[<p>Hi all,</p>
<p>there is a simply way of scanning the image along the rows using bwlabel. The idea is to separate the characters along the rows and eliminate the line space amongst the rows and then take one row at the time. Of course, this only works when there is no connection between the text rows. Below is one example:</p>
<pre>
url = 'http://blogs.mathworks.com/images/steve/186/scanned_page.png';
bw = imread(url);
bw = ~bw(1107:1194, 17:135);
imshow(bw)
% Initialize
WP = 1:size(bw,1);
% Assign 0 to the lines between characters
% and 1 to the lines filled with characters
for i = 1:size(bw,1)
    l = length(find(bw(i,:) == 0));
    if (l == size(bw,2))
        WP(i) = 0;
    else
        WP(i) = 1;
    end
end
% Find and separate the image in row-character-blocks
startofblock = strfind(WP, [0,1]);
endofblock = strfind(WP,[1,0]);
statistics = [];
for i = 1:size(startofblock,2)
    subplot(5,2,i);
    imshow(bw(startofblock(i)+1:endofblock(i),:))
    stats = regionprops(bwlabel(bw(startofblock(i)+1:endofblock(i),:)),'Image');
    statistics = cat(1, statistics, stats);
end
</pre>
<p>The only problem is that we have 20 characters instead of 19. More precisely, two caracters (&#8221;a&#8221; and &#8220;r&#8221; are viewed as one connected character &#8220;ar&#8221; as they are actually connected. On the other hand there are 2 characters that are disconnected (see &#8220;f&#8221; and &#8220;a&#8221; from the last line). However, this is another story and you can use some other algorithms for segmentation and character connection before segmentation.</p>
<p>Best regards,</p>
<p>IB</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21561</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 10 Mar 2009 13:07:05 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21561</guid>
		<description>Jagadish&#8212;The centroid is computed by taking the mean of the x- and y-coordinates of the pixels in each region.  See the function ComputeCentroid in regionprops.m, and the description of the centroid in a calculus text.</description>
		<content:encoded><![CDATA[<p>Jagadish&mdash;The centroid is computed by taking the mean of the x- and y-coordinates of the pixels in each region.  See the function ComputeCentroid in regionprops.m, and the description of the centroid in a calculus text.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jagadish</title>
		<link>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21556</link>
		<dc:creator>jagadish</dc:creator>
		<pubDate>Tue, 10 Mar 2009 01:09:48 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21556</guid>
		<description>hello steve,
            I am Jagadish.  I would like to know the stastical formula based on which centroid  of an image is caluclated by the function regionprops.
                         Thank you</description>
		<content:encoded><![CDATA[<p>hello steve,<br />
            I am Jagadish.  I would like to know the stastical formula based on which centroid  of an image is caluclated by the function regionprops.<br />
                         Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21419</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Sun, 25 Jan 2009 22:37:48 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21419</guid>
		<description>Salem&#8212;Tinkering with ordering of the labeled objects is probably not going to help with determining correspondences between images.  I don't have any suggestions for you.</description>
		<content:encoded><![CDATA[<p>Salem&mdash;Tinkering with ordering of the labeled objects is probably not going to help with determining correspondences between images.  I don&#8217;t have any suggestions for you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: salem selma</title>
		<link>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21418</link>
		<dc:creator>salem selma</dc:creator>
		<pubDate>Sun, 25 Jan 2009 11:31:29 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21418</guid>
		<description>hello,

I want making correspondance between regions labels in two images (images of the same building scene), so, initially, i segmented these images (according region segmentation technique), in order to labeling regions in each image i use regionprops.

my question is: which is the best criterions to order labeled objects?and how? knowing that this criterion must help me to doing correspondance between two images regions?

I chosed centroid criterion according:
&lt;pre&gt;
[Ld,numd] = bwlabel(right_image);
[Lg,numg] = bwlabel(left_image);

cgd=regionprops(Ld,'Centroid');
figure(8),subplot(1,2,1),imshow(right_image)
hold on
for k = 1:numel(cgd)
    c = cgd(k).Centroid;
    text(c(1), c(2), sprintf('%d', k), ...
           'Color', 'b', ...
           'FontWeight', 'bold',...
        'HorizontalAlignment', 'center', ...
        'VerticalAlignment', 'middle');
end
hold off


cgg=regionprops(Lg,'Centroid');
figure(8),subplot(1,2,2),imshow(left_image)
hold on
for k = 1:numel(cgg)
    c = cgg(k).Centroid;
    text(c(1), c(2), sprintf('%d', k), ...
           'Color', 'b', ...
           'FontWeight', 'bold',...
        'HorizontalAlignment', 'center', ...
        'VerticalAlignment', 'middle');
end
hold off
&lt;/pre&gt;

But, i found it false way because same regions don't have same centroids in two images.

can you help me please?

NB: I have matlab v.7.6(R 2008a).</description>
		<content:encoded><![CDATA[<p>hello,</p>
<p>I want making correspondance between regions labels in two images (images of the same building scene), so, initially, i segmented these images (according region segmentation technique), in order to labeling regions in each image i use regionprops.</p>
<p>my question is: which is the best criterions to order labeled objects?and how? knowing that this criterion must help me to doing correspondance between two images regions?</p>
<p>I chosed centroid criterion according:</p>
<pre>
[Ld,numd] = bwlabel(right_image);
[Lg,numg] = bwlabel(left_image);

cgd=regionprops(Ld,'Centroid');
figure(8),subplot(1,2,1),imshow(right_image)
hold on
for k = 1:numel(cgd)
    c = cgd(k).Centroid;
    text(c(1), c(2), sprintf('%d', k), ...
           'Color', 'b', ...
           'FontWeight', 'bold',...
        'HorizontalAlignment', 'center', ...
        'VerticalAlignment', 'middle');
end
hold off

cgg=regionprops(Lg,'Centroid');
figure(8),subplot(1,2,2),imshow(left_image)
hold on
for k = 1:numel(cgg)
    c = cgg(k).Centroid;
    text(c(1), c(2), sprintf('%d', k), ...
           'Color', 'b', ...
           'FontWeight', 'bold',...
        'HorizontalAlignment', 'center', ...
        'VerticalAlignment', 'middle');
end
hold off
</pre>
<p>But, i found it false way because same regions don&#8217;t have same centroids in two images.</p>
<p>can you help me please?</p>
<p>NB: I have matlab v.7.6(R 2008a).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lester</title>
		<link>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21000</link>
		<dc:creator>Lester</dc:creator>
		<pubDate>Fri, 22 Aug 2008 18:31:11 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2008/03/25/bwlabel-search-order/#comment-21000</guid>
		<description>Thanks. 
So this displays the cropped image with all the white objects. The array may have only 9 outputs, but the figure shows 13.</description>
		<content:encoded><![CDATA[<p>Thanks.<br />
So this displays the cropped image with all the white objects. The array may have only 9 outputs, but the figure shows 13.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
