MATLAB Answers

mee mee
0

What is the difference in these two methods of finding coordinates of image?

mee mee
さんによって質問されました 2016 年 1 月 18 日
最新アクティビティ mee mee
さんによって 回答されました 2016 年 1 月 19 日
I am trying to find coordinates of a line in my binary image. I used two methods.
1) X=imread('line.png'); [I,J] = find(X ==0); this methods give me multiple coordinates of the whole image.
2) A=imread('line.png'); image(A) [x,y]=ginput(); this methods give me the coordinates of the points on the line that I click by mouse.
Using method 2, I click multiple points (between start and end point of the line) and I get coordinates of those points. But when I compared the results getting from method 2 and method 1, they are different. I know that the cooridinate points may be different depending on my clicking. But I think the start and end coordinate (i.e. start and end of the line) should be the same?
Can anyone help me what the difference between these two methods? Are they finding different coordinate system?
Thanks.

  0 件のコメント

サインイン to comment.

3 件の回答

回答者: David Young
2016 年 1 月 18 日
 採用された回答

The results of find are [row, column]. The results of ginput are [column, row].
That is, find uses the matrix convention for coordinate ordering, but ginput uses the image and graphics convention.
Does this explain the difference you observe?

  0 件のコメント

サインイン to comment.


回答者: mee mee
2016 年 1 月 19 日

Hi David,
Thanks for the answer. yes, that partly explains my query.
Can you please explain a little bit more? Sorry for my ignorance. I am new user of matlab.Attached is my line file (just an example).
I run that file using method 2 (i.e ginput). I got x and y coordinates of start and end points as below x =
226.2512
293.0899
y =
169.2061
169.2061.
Then I run the same file with method 1 (find). For y coordinates, it is the same as above (i.e. all 169). But I got x value in three different sets of value as below (one group around 220, second group around 800 and third group around 1400). What do those three group mean? Thanks a lot.
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477

  0 件のコメント

サインイン to comment.


回答者: mee mee
2016 年 1 月 19 日

sorry, here is the file of line.png.

  0 件のコメント

サインイン to comment.



Translated by