I want to redraw any sketch within R with polygon. But I need a painstaking work to find coordinates (X or Y values for each points).
Is there any R package or other software that can find coordinates from an image ? Thus output will be data with considerably high number of points (x,y) so that the figure can be recreated.
Edits: ........
Here are examples:
(1) Map outline for example:
Second example:
(2) Object shape example:
You can use WebplotDigitizer app, you can use online. Here is snapshot of your example:
Here is output cordinates:
2 202
4 205
5 200
6 206
8 199
8 207
10 197
10 208
12 210
13 195
14 211
16 193
16 212
19 191
18 213
20 215
21 189
22 216
24 218
24 187
26 219
27 185
27 222
30 184
29 223
30 225
32 227
32 182
33 230
35 234
35 181
36 237
38 179
38 240
37 237
40 178
40 241
41 244
43 176
43 244
45 246
46 174
48 248
48 250
49 172
49 253
49 257
50 261
51 263
51 169
53 266
54 167
55 268
56 164
57 270
57 416
57 420
58 422
58 453
59 161
59 273
59 432
59 435
59 438
59 441
59 443
59 446
59 449
59 451
59 457
59 459
59 276
60 279
60 413
60 462
60 428
60 423
61 425
61 158
61 282
62 401
61 405
60 441
60 445
62 285
62 395
62 398
62 409
62 412
62 464
63 155
62 428
63 466
63 391
64 287
65 152
63 394
65 389
65 467
66 308
67 149
67 286
67 303
67 306
67 311
68 300
68 387
68 468
69 146
69 314
69 297
70 285
71 143
70 385
71 469
71 295
72 314
73 140
72 286
73 383
73 469
74 294
74 137
74 313
75 286
76 135
76 383
76 469
77 293
77 311
78 132
78 286
79 129
79 382
79 469
79 292
80 308
80 322
80 326
81 126
81 285
81 319
80 129
82 382
82 469
82 291
82 316
83 123
82 306
82 325
83 283
84 120
84 313
84 382
84 469
85 290
85 303
85 325
86 117
86 299
86 281
85 120
86 311
87 114
87 296
87 383
87 469
87 289
88 324
88 336
89 111
89 279
89 310
89 114
90 294
90 332
89 383
90 468
90 287
91 107
91 323
91 326
91 329
90 337
90 110
92 277
92 104
92 306
92 310
92 294
92 312
92 332
92 383
93 468
93 285
93 297
93 300
93 302
92 328
94 338
94 100
94 275
95 97
94 103
94 305
95 384
95 467
96 94
96 282
96 338
97 91
97 274
98 88
98 384
98 466
99 85
98 280
99 338
99 82
100 273
101 79
101 384
101 465
101 277
102 338
102 75
102 272
104 72
103 384
103 463
104 275
104 338
105 69
106 384
106 462
107 65
107 338
106 68
108 62
109 384
109 461
110 59
110 338
110 62
112 56
112 384
112 460
113 338
114 52
113 55
114 384
115 459
115 49
115 337
116 46
117 43
117 384
117 458
118 40
118 337
119 36
120 384
120 457
120 33
121 337
122 30
123 384
123 457
124 27
123 337
125 384
125 457
126 25
126 337
128 384
128 457
128 23
129 337
131 384
131 457
131 21
132 337
134 384
133 458
134 20
134 337
136 384
136 459
137 19
137 337
139 384
139 460
139 18
140 337
142 384
142 461
142 18
143 337
144 384
145 462
145 19
145 337
147 384
147 462
147 20
148 338
150 22
150 384
150 463
151 338
152 23
153 384
153 463
154 25
154 338
155 384
155 463
156 25
156 338
158 384
158 463
159 26
159 338
161 384
161 463
162 26
162 338
164 384
164 463
164 367
164 25
165 338
165 372
166 375
165 378
165 381
166 384
167 463
167 366
166 368
167 25
167 338
169 462
170 365
170 25
170 338
172 462
172 365
173 25
173 338
175 461
175 365
176 26
175 338
177 461
178 365
178 27
178 338
180 28
180 460
181 366
181 339
183 29
183 458
183 367
184 339
185 369
186 29
185 457
186 339
187 369
188 28
188 456
189 338
190 367
191 26
191 455
192 338
193 365
193 25
194 454
195 337
195 27
196 364
196 452
197 335
198 27
198 364
199 332
199 451
200 26
201 329
201 363
202 449
203 326
203 23
204 324
204 363
205 448
205 21
206 321
207 364
207 446
208 20
208 319
209 364
210 445
211 20
211 318
212 364
213 443
214 21
214 318
214 364
216 442
217 22
217 319
218 363
219 441
219 22
219 320
220 362
221 440
222 22
222 321
223 360
224 439
225 22
225 321
226 357
227 439
227 20
228 320
228 353
229 349
229 345
229 439
230 18
230 318
231 342
232 438
233 315
233 17
233 340
235 438
235 313
235 18
236 339
238 20
237 438
238 312
239 339
240 20
240 439
241 312
241 341
242 344
243 20
243 347
243 439
244 14
243 312
244 350
246 19
246 439
246 12
246 16
246 313
247 353
247 315
248 18
249 439
249 12
249 354
250 316
251 318
251 440
252 12
252 355
253 319
254 440
254 13
254 356
255 320
257 15
256 440
257 356
257 320
259 14
259 440
260 357
260 320
262 12
262 440
263 357
263 320
265 10
265 440
265 358
266 321
268 7
268 440
268 323
268 359
270 4
270 326
270 440
271 329
271 360
272 332
273 3
273 440
274 361
274 334
275 5
276 363
276 440
277 335
278 6
278 364
279 366
279 441
279 8
280 335
281 368
281 441
281 9
282 11
283 335
283 369
284 441
285 13
285 335
286 14
286 370
287 441
288 334
288 15
288 369
289 441
291 16
291 334
291 368
292 441
294 15
294 333
294 369
295 442
296 16
296 334
296 371
298 442
299 15
299 336
299 372
300 374
301 338
300 442
302 15
302 375
303 377
303 339
303 442
304 341
304 14
306 343
305 378
306 442
307 380
307 14
308 346
309 442
309 380
310 14
310 349
311 443
312 381
312 352
313 13
314 443
315 381
315 354
315 13
316 355
317 443
318 382
318 14
319 356
320 443
320 382
321 14
321 356
322 443
323 382
323 16
324 356
325 444
326 382
326 18
327 20
327 356
328 444
328 381
329 21
329 356
330 23
331 444
331 381
332 355
333 24
333 444
334 26
334 381
335 352
336 444
336 26
337 381
337 28
338 350
339 444
339 380
339 29
340 348
341 31
342 444
342 378
344 347
344 32
344 445
345 35
345 376
346 346
347 37
347 445
347 374
348 40
349 347
350 44
350 445
350 373
351 47
352 347
353 50
352 445
353 373
354 347
355 51
355 445
356 373
356 53
357 348
358 445
358 373
359 54
360 349
360 56
361 445
361 373
362 350
363 57
363 59
363 445
364 373
364 352
365 62
365 355
366 445
367 373
367 65
368 356
369 445
369 67
369 372
370 358
372 445
372 68
372 372
373 359
373 360
374 445
375 69
375 370
375 363
376 366
377 445
377 68
376 368
377 366
380 445
380 68
383 445
383 67
385 445
386 68
388 70
388 445
390 70
391 446
393 70
393 446
396 69
396 446
398 68
399 446
401 69
402 446
404 71
404 446
406 72
407 446
408 73
410 75
410 446
412 75
413 447
414 77
415 447
416 78
418 80
418 447
420 81
421 447
422 84
424 446
424 84
424 87
425 90
426 93
426 96
426 446
427 100
429 446
430 102
432 105
432 446
434 107
435 446
436 109
436 127
436 124
438 121
437 446
438 111
438 114
438 118
438 128
440 447
440 114
440 117
441 128
443 448
444 127
444 450
446 461
446 454
446 458
447 128
446 451
447 465
447 461
449 129
450 465
450 132
452 134
452 137
452 466
455 138
455 466
458 139
458 466
460 139
460 461
460 466
463 140
463 460
466 140
466 460
467 143
468 461
469 146
469 150
469 153
470 156
469 143
471 158
471 462
473 464
474 159
475 160
475 465
476 167
477 467
477 161
477 163
478 169
479 469
479 163
480 172
482 470
482 174
484 469
485 177
487 180
487 468
490 181
490 470
491 183
491 472
493 184
493 473
494 475
495 186
497 478
497 187
499 479
500 187
502 186
502 479
504 184
505 478
507 185
508 477
508 188
509 191
510 477
511 193
511 197
512 200
513 478
514 203
515 480
516 205
518 481
519 207
519 483
521 209
521 484
523 211
523 485
525 212
526 485
526 213
529 485
529 214
531 216
531 484
533 217
534 219
534 483
536 220
537 481
538 222
539 480
540 250
540 254
540 256
540 223
541 247
541 259
542 225
542 243
542 481
543 240
543 260
544 226
544 228
544 237
545 230
545 234
545 481
545 240
546 261
547 231
547 233
547 481
549 263
550 480
551 265
552 267
553 479
554 268
555 336
555 270
555 333
555 340
556 342
556 478
556 330
557 271
558 327
558 345
559 274
559 477
560 277
560 289
560 293
560 296
560 299
560 348
560 301
561 280
561 284
561 286
561 325
562 477
562 304
562 289
562 349
562 301
563 307
563 322
564 352
564 477
565 311
565 319
565 307
566 315
566 353
567 477
568 355
567 312
570 477
570 356
571 358
572 477
573 360
574 365
575 368
575 371
575 478
575 361
576 374
578 478
579 375
579 377
581 478
582 378
583 479
585 378
586 479
587 376
589 479
589 373
591 479
592 372
594 478
594 372
597 478
597 373
599 375
600 477
601 376
603 378
602 477
605 379
605 477
606 381
608 477
609 381
611 383
611 477
613 384
613 476
614 400
614 404
615 386
615 397
615 407
616 390
616 393
616 476
617 409
617 454
617 395
618 412
618 449
618 458
619 447
619 461
619 476
620 416
619 453
620 443
619 412
621 418
621 439
620 446
621 463
622 475
622 422
622 436
623 465
623 425
623 428
623 431
623 433
622 443
623 419
624 473
624 435
625 466
626 468
626 471
628 468
For the second figure cordinates are:
123,268
127,277
132,257
136,281
141,253
144,283
149,251
153,286
158,249
162,287
167,248
167,114
166,127
166,136
167,148
169,162
169,176
169,185
169,194
169,202
169,211
169,220
169,229
169,237
169,261
171,288
173,269
175,104
171,242
176,119
179,156
178,54
179,289
180,67
182,43
182,272
184,101
184,38
185,121
186,73
188,153
188,290
189,48
190,273
193,101
193,37
194,122
194,87
194,165
194,78
197,290
197,29
199,109
199,274
201,17
203,100
203,122
203,166
203,78
205,290
208,274
207,27
212,39
211,101
211,122
211,160
212,74
212,150
215,41
214,290
216,272
219,31
220,102
220,120
219,68
221,156
221,42
223,289
222,51
222,59
225,269
229,106
229,119
230,156
231,288
231,174
231,187
231,196
231,204
231,213
231,222
231,230
231,239
232,248
231,256
231,264
230,269
234,133
233,144
235,111
235,120
235,151
240,287
241,249
249,285
250,251
258,283
258,253
266,279
267,256
275,274
276,262
280,270
Plot in R:
candlefig <- read.csv(file.choose(), sep = ",", head = TRUE)
plot(rev(candlefig$x), rev(candlefig$y), type = "p", pch = 19, col = "red")
You can increase number of points in the software. However connecting lines in order may be bit problem in complex figure like this.
Online youtube tutorial video is here: For creating map tutorial. ternary diagram polar plot
Helplink:
In R you may want to look at the digitize package, it has tools for reading a jpeg image and clicking on the image to get the points for the polygon(s). I belive that some of the spatial packages have some similar functionality for maps, but don't remember which packages).
You can do something similar by plotting your image using the image
or rasterImage
function (see the EBImage or other packages for reading in the jpeg), then using the locator
function (see the type
argument) to click on the plot and get the coordinates. If you want to specify a different coordinate system then look at the updateusr
function in the TeachingDemos package.
For a more automated approach you can look at the potrace program. Inkscape has a builtin call to potrace with a little nicer interface and more options for preprocessing and postproccessing the image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With