フィルターのクリア

confusion in VL_SLIC , outpur varies depending on how image is read

3 ビュー (過去 30 日間)
Swagatika
Swagatika 2012 年 10 月 29 日
コメント済み: Image Analyst 2017 年 5 月 31 日
Hi, I am using VL_SLIC to implement segmentation. However the outputs vary depending on how I read the image.
Way1: Read the img as im2double , so the intensity ranges from 0 to 1. Here, the output superpixels are more regular and spacious.
%Input
img = im2double(imread('Images/2_14_s.bmp'));
regionSize = 30 ;
regularizer = 0.1;
%get the SLIC superpixels
vl_setup
segments1 = vl_slic(single(img), regionSize, regularizer) ;
Way2: Read the img as uint8 , so the intensity ranges from 0 to 255. Here, the output superpixels are more irregular but tightly fit to the edges.
%Input
img = imread('Images/2_14_s.bmp');
regionSize = 30 ;
regularizer = 0.1;
%get the SLIC superpixels
vl_setup
segments1 = vl_slic(single(img), regionSize, regularizer) ;
here are the images:
I want to know which is the right way? and why this change is affecting the performance?
  2 件のコメント
Walter Roberson
Walter Roberson 2012 年 10 月 29 日
This is not depending on how the image is read: this is depending on how you treat the data after it is read.
Swagatika
Swagatika 2012 年 11 月 4 日
Can you please elaborate?

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2012 年 11 月 4 日
After a search, it appears that vl_slic() is in a third party package available at http://www.vlfeat.org/overview/slic.html. It looks like regularizer needs to be changed by 255 to get the same values in the two methods because the input images differ by a factor of 255 in the two cases.

その他の回答 (3 件)

Walter Roberson
Walter Roberson 2012 年 11 月 4 日
In both cases you are using imread(). That accomplishes all of the image reading. Using im2double() is processing after the image has been read.
MATLAB routines can generally handle images represented in several different ways, and the different ways are distinguished internally by examining the datatype (e.g., double or uint8) When the datatype is double then the data must be in the range 0 to 1, and the routines are permitted to malfunction if the data is some other range instead. When the datatype is uint8 then the data range is the integers 0 to 255. When you double() a uint8 matrix and pass the result into a MATLAB image routine, the image routine is going to get confused.

Dark
Dark 2014 年 6 月 6 日
I have one question since this is concerning VL_SLIC. I am also using the VLFeat package. My question is how do I view the image with superpixels ? I tried imshow(segments) but just get a black image.
  1 件のコメント
Image Analyst
Image Analyst 2014 年 6 月 6 日
It's probably a floating point array, so use []:
imshow(segments, []);

サインインしてコメントする。


ibtissem maidi
ibtissem maidi 2017 年 5 月 29 日
編集済み: Walter Roberson 2017 年 5 月 29 日
when i use this code
segments = vl_slic(img,regionSize, regularizer)
i have this error :
Undefined function 'vl_slic' for input arguments of type 'double'."
i don't know where is a matter some one can help me please !
  2 件のコメント
Image Analyst
Image Analyst 2017 年 5 月 31 日
Or instead, simply just use the superpixels() function built in to the Image Processing Toolbox: https://www.mathworks.com/help/images/ref/superpixels.html?s_tid=srchtitle

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by