필터 지우기
필터 지우기

Image to patches for local features extraction

조회 수: 2 (최근 30일)
hamed abdulaziz
hamed abdulaziz 2014년 2월 28일
댓글: hamed abdulaziz 2014년 3월 2일
Hi All,
I have an image and I need to extract local features,so I divided it to 32 * 32 patches and size of each patch =16 *16 pixels and extract that three color histograms features locally from each patch, now I need to :
1-Store these features in the descriptor x like in figure:
2-Store these feature discroptors in the X like in figure:
3-Store these X's in the global matrix called G like in figure:
I tried this code :
patches_counter=1;
for g=1:32
for u=1:32
if nom_ones>area_of_patch_by_two
patch_h=h_seg_image_cell{g,u} ;
patch_s=s_seg_image_cell{g,u} ;
patch_v=v_seg_image_cell{g,u} ;
% Describe each patch by 3 color histograms features
[patch_h_ftr1,xh]=imhist(patch_h);
[patch_s_ftr2,xs]=imhist(patch_s);
[patch_v_ftr3,xv]=imhist(patch_v);
end
% Create features vector
x=[patch_h_ftr1;patch_s_ftr2;patch_v_ftr3];
X(:,patches_counter) = x(patches_counter);
patches_counter=patches_counter+1;
end
end
But I got this ERROR
In an assignment A(I) = B, the number of elements
in B and I must be the same.
Error in my_im2blocks1 (line 72)
X_image_vector(patches_counter) =
x_featurs_vector_patch;
Hint : Don't care about this condition
if nom_ones>area_of_patch_by_two
It works well.
Please make any correction and thanks in advance.

답변 (2개)

Image Analyst
Image Analyst 2014년 2월 28일
Capital X is undefined in the code you gave and it may not like you to poof it into existence like that. Also, before that line do
whos X
whos x
whos patches_counter
and make sure that the number of rows in X matches the length of patches_counter.
  댓글 수: 6
Image Analyst
Image Analyst 2014년 3월 1일
You never followed my suggestion of doing "whos" and you didn't attach your m-file. It's difficult for me to try to figure this out without being able to run it, because you have variables that are just suddenly there (like h_seg_image_cell{g,u}, etc.), and variables change names, etc. So I think the best bet is for you to step through this in the debugger. Don't you agree?
hamed abdulaziz
hamed abdulaziz 2014년 3월 1일
편집: hamed abdulaziz 2014년 3월 1일
O.K I agree I will attach my m-file now,to take look on it please wait....

댓글을 달려면 로그인하십시오.


hamed abdulaziz
hamed abdulaziz 2014년 3월 1일
I attached my_tried_code.m ,Otsu code for segmentation,and image for test; please could you run it and correct it with my thanks. Hint: I am tried to implement the steps in the thesis (page 44 to 49 in pdf-file)on this website for local features :
  댓글 수: 2
hamed abdulaziz
hamed abdulaziz 2014년 3월 1일
Image Analyst:I am waiting your answer
hamed abdulaziz
hamed abdulaziz 2014년 3월 2일
could I have an answer?thanks

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by