can someone explain about this source code. its feature extraction for training back propagation. what is the input for training? whats mean by column 'number' through 'number' after run this. can someone explain details. thanks in advance

1 view (last 30 days)
clc
close all
clear all
feature_extraction = [];
feature_extra = [];
j1=1;
j2=1;
% for j=65:70
for j=1:828
...for i=1:5
RGB = imread(['frame',num2str(j),'.jpg']);
img_crop = RGB;
I= rgb2gray(RGB);
I = imresize(I,[80 64],'bicubic');
...figure, imshow(I);
BW = edge(I,'canny',0.25); %Finding the edges of the image
[imx,imy]=size(BW);
msk=[0 0 0 0 0;
0 1 1 1 0;
0 1 1 1 0;
0 1 1 1 0;
0 0 0 0 0;];
B=conv2(double(BW),double(msk)); %smoothing the image to reduce the number of connected components
....figure,imshow(B);
bw_resize=imresize(B,[70,50]);
for fr=1:7
for fc=1:5
...Atemp=sum(bw_resize((fr*10-9:fr*10),(fc*10-9:fc*10)))
temp=bw_resize((fr*10-9:fr*10),(fc*10-9:fc*10));
Atemp = sum(temp);
sum_feature((fr-1)*5+fc)=sum(Atemp)
end
end
sum_feature=((100-sum_feature)/100);
sum_feature=sum_feature;
feature = [sum_feature];
feature_extra = [feature_extra; feature];
data_target(j1,j2) = 1;
j2 = j2+1;
...end
j1 = j1+1;
end
...store these feature for training...
  15 Comments
meed negne
meed negne on 27 May 2015
this my actual source. but it not working
feature_extraction = [];
feature_extra = [];
j1=1;
j2=1;
for j=1:450
RGB = imread(['frame',num2str(j),'.jpg']);
img_crop = RGB;
I= rgb2gray(RGB);
I = imresize(I,[80 64],'bicubic');
BW = edge(I,'canny',0.25); %Finding the edges of the image
[imx,imy]=size(BW);
msk=[0 0 0 0 0;
0 1 1 1 0;
0 1 1 1 0;
0 1 1 1 0;
0 0 0 0 0;];
B=conv2(double(BW),double(msk)); %smoothing the image to reduce the number of connected components
bw_resize=imresize(B,[70,50]);
Image Analyst
Image Analyst on 27 May 2015
What is the problem again? Is it that it prints stuff to the command window still? Because it does not look like it would do that since every line has a semicolon at the end of it. Is it that you're missing and "end" for your "for"? If there is any error, please paste all the red text here.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 25 May 2015
It looks like the input is 5 jpeg images called Frame1.jpg through Frame5.jpg. There is no reason to read it 5 times during the i loop. It should be pulled out and be put inside the j look but above the i loop since the filename depends only on j, not i. I'm not exactly sure what it's doing but it looks like it's something with computing and saving the normalized intensity of a blurred version of the edge image.
I have no idea what you mean by "column 'number' through 'number'". I don't see anywhere in the code where column or number is mentioned

More Answers (0)

Community Treasure Hunt

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

Start Hunting!