# help me in calculating

조회 수: 31(최근 30일)
i convert rgb image to binary image,the rgb image is of agriculture crops either side with midlle path,i convert that rgb to binary image by making path as white and remaing trees as black, it gives a image of size 435*1200 means the matrix is also of same size.now i have to scan each row and find the pixel column number whose value is 1 and add the column numbers to find the mean distance in between them.
this has to be performed for all the 435 rows.

#### 댓글 수: 2

darova 23 Jan 2020 10:26
It's hard to tell something without any data or example? Can you provide something?
harshavardhanreddy reddy 23 Jan 2020 11:02
if i have the matrixof size 435*1200 like this how to calculates pixel coordinates for every pixel whose value is 1 and find mean point and joining of all mean points give straight line.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 01 1 1 0 0
0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0
0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 00 0 0 0

로그인 to comment.

### 답변(2개)

KALYAN ACHARJYA 23 Jan 2020 11:03
편집: KALYAN ACHARJYA 23 Jan 2020 11:15
now i have to scan each row and find the pixel column number whose value is 1 and add the column numbers to find the mean distance in between them.
Let say bw is the binary image
[r c]=find(bw==1);
Do with loop or other way to get the mean of individual row

#### 댓글 수: 2

harshavardhanreddy reddy 23 Jan 2020 11:30
i have to find mean point in the row by adding column numbers .
can you please elobarately mention the code or answer,because i am not that much experience in matlab ,
i am highly thankful to you in this regrad.
KALYAN ACHARJYA 23 Jan 2020 12:27
for i=1:length(r)
[r,c]=find(bw(i,:)==1);
col_mean(i)=mean(c);
end
col_mean are the corresponding mean data of cloumns in respective rows. I have no clue what exactly you are trying to do.

로그인 to comment.

Image Analyst 23 Jan 2020 13:30
You need to take your binary image (which unfortunately you forgot to attach) and rotate it using the radon transform and imrotate() like in the attached example.
Then, once you have the crop rows aligned with the image edges, you"
1. Invert the binary image (to get space instead of plants) and
2. Call imclearborder() to remove any space not fully visible in the image, then
3. Scan across the rows (or columns) getting the width of the spaces on each row (or column) using regionprops()
4. After all rows have been scanned, compute the mean spacing.

#### 댓글 수: 3

harshavardhanreddy reddy 24 Jan 2020 4:13
already the agriculture path is of straight in image or its approximately straight ,what is the need of rotating the image for calculating the row distance avaible.can you please give code for solving this images.
Image Analyst 24 Jan 2020 12:43
I thought you had an already segmented photo of an overhead view. Why is this needed? Why some complicated vision system when simply using a tape measure will do the job much more simply?
You should look into the camera calibration capability of the Computer Vision Toolbox - it can do that.
harshavardhanreddy reddy 27 Jan 2020 3:42
can you please explain elobarately how to do this to an image.

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.

Translated by