Mathematica Asked by TheFarstrider on March 26, 2021
So I have a list of 50 lines that ive acquired using the EdgeDetect function on a .bmb from an experiment ive run. The list looks like:
lines = {{{{938.0182717999902`,
641.693689525029`}, {934.881599312007`,
649.5937708982256`}}, {{931.006886238616`,
659.3526949474685`}, {899.8246715051359`,
737.8887980104239`}}, {{892.075245358354`,
757.4066461089099`}, {887.4624916995551`,
769.0244128341991`}}, {{884.1413090652201`,
777.3892048764073`}, {881.5581670162927`,
783.8951542425693`}}, {{944.1071066296046`,
626.3582374476471`}, {943.0000457514928`,
629.1465014617165`}}}, {{{510.34613621146997`,
794.0249603966897`}, {506.98736124699525`,
787.3190949985463`}}, {{501.16548464190583`,
775.6955949750976`}, {468.92124498294885`,
711.3192871529201`}}, {{459.96451174434975`,
693.4369794245375`}, {453.02304348443533`,
679.578190935041`}}}, {{{936.0000959307632`,
663.7025592719378`}, {930.8499743185687`,
673.9848862157578`}}, {{926.1476893683041`,
683.3730977731587`}, {917.8627111225999`,
699.9142324219126`}}, {{908.0103045601409`,
719.5847709231335`}, {881.8118598372382`, 771.8905210286528`}},
{{877.1095748869737`, 781.2787325860536`}, {873.750799922499`,
787.9845979841971`}}}, {{{534.1400686554078`,
420.12961807233677`}, {546.6156584942452`,
414.9711630543011`}}, {{563.2497782793616`,
408.0932230302535`}, {638.5653761953058`,
376.9514390324826`}}, {{655.1994959804224`,
370.07349900843496`}, {668.1371447021796`,
364.72399010084246`}}}, {{{498.2954016379278`,
777.8325788373728`}, {493.06449257585854`,
765.3871945369841`}}, {{486.0899471597662`,
748.7933488031325`}, {453.92954329667367`,
672.2772823637057`}}, {{446.95499788058135`,
655.6834366298541`}, {442.8865130545274`,
646.0036932851073`}}}, {{{725.057713368362`,
367.92360979187123`}, {739.3015594484755`,
374.03612554612766`}}, {{755.3833211518296`,
380.93735301061076`}, {827.5215093640177`,
411.8942876370063`}}, {{846.3601445022324`,
419.9785826668293`}, {855.5497226184347`,
423.9221412179625`}}}, {{{533.9548792391797`,
812.3829053385664`}, {542.7157969469038`,
816.0566392590467`}}, {{559.3154304983809`,
823.0173982662726`}, {630.7860749561295`,
852.9873328807173`}}, {{651.9967178274613`,
861.881636056617`}, {662.1409383311417`,
866.1354332276994`}}, {{635.3970842759842`,
854.9208770493912`}, {635.8581852079697`,
855.1142314662585`}}}, {{{728.3668171708799`,
865.1339222802936`}, {742.04078745569`,
858.9676805845658`}}, {{763.919139911386`,
849.1016938714012`}, {832.288991335436`,
818.2704853927619`}}, {{850.065152705689`,
810.2543711883156`}, {859.636931905056`,
805.9380020013061`}}}, {{{936.977320256363`,
570.7964241338441`}, {929.8989204686031`,
555.340154970665`}}, {{920.9468266193772`,
535.792520440762`}, {890.9677216359235`,
470.33067457318015`}}, {{885.3466394515258`,
458.0565784730085`}, {880.766498412387`,
448.055463132128`}}, {{923.0287089098949`,
540.3384819593441`}, {923.0287089098949`,
540.3384819593441`}}}, {{{441.90044115645924`,
590.6879443671335`}, {446.04444798644636`,
580.4983807163669`}}, {{453.0139140186973`,
563.3613873037143`}, {483.9056012967825`,
487.4028219070916`}}, {{491.81688706312127`,
467.9500185738103`}, {496.1492578399259`,
457.2972929389182`}}}, {{{518.3373721214956`,
801.0986706095794`}, {525.0515867862819`,
804.4407240853889`}}, {{534.4514873169825`,
809.119598951522`}, {596.6698765440015`,
840.0892944940225`}}, {{612.3363774285026`,
847.8874192709111`}, {626.6600353800465`,
855.0171333526379`}}}, {{{453.85378853766207`,
551.048222608234`}, {460.99539838630477`,
536.7304920349285`}}, {{469.92241069710815`,
518.8333288182964`}, {501.16695378491994`,
456.1932575600845`}}, {{505.8536352480917`,
446.79724687135274`}, {509.201264864643`,
440.0858106651157`}}}, {{{570.0541850855988`,
831.8088263684696`}, {585.7045911653198`,
837.035181651057`}}, {{609.4173276497457`,
844.9539017761894`}, {663.4823668342368`,
863.0085836614912`}}, {{678.1842634545808`,
867.9181901390732`}, {684.8238296702201`,
870.1354317741103`}}, {{588.5501195434509`,
837.9854280660728`}, {588.5501195434509`,
837.9854280660728`}}, {{606.097544541926`,
843.8452809586707`}, {606.5717992716146`,
844.0036553611734`}}, {{666.3278952123678`,
863.958830076507`}, {666.8021499420564`,
864.1172044790097`}}}, {{{706.7768745895008`,
869.1191506798796`}, {715.2244069551125`,
866.0144450687233`}}, {{726.0184760889495`,
862.0473212322458`}, {788.436354123746`,
839.1069964387025`}}, {{813.3096438669356`,
829.965363250298`}, {826.4502497689981`,
825.1358211884993`}}, {{791.2521982456166`,
838.072094568317`}, {791.7215055992616`,
837.8996109232528`}}, {{810.4937997450651`,
831.0002651206834`}, {810.4937997450651`,
831.0002651206834`}}}, {{{516.1366250381197`,
433.24471622944947`}, {524.6271842378811`,
428.9832136217594`}}, {{534.0114865113014`,
424.2731317922072`}, {596.5735016674372`,
392.87258626185945`}}, {{612.2140054564711`,
385.02244987927253`}, {628.3013807823346`,
376.9480238857545`}}}, {{{703.5649354181747`,
363.9096398724151`}, {709.6951928983599`,
366.07064501508216`}}, {{723.3703826618499`,
370.8913487948781`}, {783.7298409282886`,
392.16893789190834`}}, {{808.2508708490292`,
400.81295846257683`}, {825.6985267541716`,
406.96351156093715`}}}, {{{869.9015661351866`,
435.0980688916539`}, {863.2209981930705`,
431.68925502598603`}}, {{850.7506047011202`,
425.3261358100727`}, {793.297720398921`,
396.010336565329`}}, {{777.7097285339833`,
388.05643754543735`}, {763.9032214536098`,
381.0115555563904`}}}, {{{940.1508355287278`,
627.7202241366501`}, {936.3395098709427`,
639.6250045516897`}}, {{933.5953553973375`,
648.1964464505181`}, {920.941754213491`,
687.7203174284493`}}, {{914.0813680294777`,
709.1489221755206`}, {908.7455121085786`,
725.815614756576`}}, {{904.1719213192365`,
740.1013512546233`}, {900.6655017140743`,
751.0537492364597`}}, {{920.0270360556226`,
690.5774647280589`}, {920.0270360556226`,
690.5774647280589`}}}, {{{944.0200389113847`,
601.5961457494698`}, {940.9504455220562`,
593.1357913582997`}}, {{936.0049895059158`,
579.505220394748`}, {913.6651709502471`,
517.9326412145658`}}, {{905.9911874769258`,
496.78175523664066`}, {900.0225336643426`,
480.33106614269883`}}, {{907.0143852733686`,
499.60187336703063`}, {907.0143852733686`,
499.60187336703063`}}}, {{{930.1189968883771`,
550.6839876157549`}, {923.876270338755`,
539.2809895351339`}}, {{919.074172992892`,
530.5094525500409`}, {910.9106075049248`,
515.5978396753827`}}, {{901.0663079459055`,
497.616188855942`}, {878.9766601549354`,
457.2671187245141`}}, {{873.2141433398997`,
446.74127434240245`}, {870.572989799675`,
441.9169290006013`}}}, {{{575.1148327125937`,
399.08775168869727`}, {590.7738999399169`,
393.88740424163416`}}, {{608.331035922067`,
388.0567116494725`}, {662.9005126233444`,
369.934288727889`}}, {{677.610545473254`,
365.04911385337516`}, {683.7792689264419`,
363.00049213180483`}}, {{674.7634423410135`,
365.994631571023`}, {674.7634423410135`,
365.994631571023`}}}, {{{438.8541506243913`,
609.5816272118383`}, {441.0548395332715`,
602.936556232057`}}, {{445.9277935457918`,
588.2224704911126`}, {465.1052254660333`,
530.3154233815897`}}, {{471.86448425759374`,
509.9055625151185`}, {477.0518223999541`,
494.24218091991975`}}}, {{{922.9183163334442`,
700.4962389643329`}, {917.047410463922`,
710.3847405834464`}}, {{910.9212478174642`,
720.7031770555648`}, {905.050341947942`,
730.5916786746783`}}, {{895.0953276474478`,
747.3591379418708`}, {874.6747854925881`,
781.7539261822656`}}, {{870.3354202846804`,
789.0628186833494`}, {867.0170821845156`,
794.6519717724135`}}, {{863.1882305304795`,
801.1009945674875`}, {861.4014330919292`,
804.1105385385221`}}}, {{{768.4729337235327`,
851.1454738700766`}, {783.9129754458769`,
842.9080524524078`}}, {{800.6764493158506`,
833.964566341796`}, {854.0548792702407`,
805.4866237264264`}}, {{864.2011924020669`,
800.0734610805298`}, {869.053776943375`,
797.4845572064053`}}}, {{{463.25224269276856`,
705.8644674132026`}, {460.84233857240315`,
696.1591924490068`}}, {{456.98649197981854`,
680.6307525062936`}, {452.88965497519746`,
664.1317850671606`}}, {{451.08222688492333`,
656.8528288440137`}, {442.88855287568106`,
623.854893965748`}}, {{440.11716313726083`,
612.6938277569228`}, {438.91221107707815`,
607.841190274825`}}, {{452.04618853306954`,
660.7349388296922`}, {451.92569332705125`,
660.2496750814825`}}, {{442.1655816395714`,
620.9433114764894`}, {441.9245912275349`,
619.9727839800697`}}}, {{{509.19986827942984`,
786.9329244529322`}, {481.86390053587496`,
740.3631395326287`}}, {{473.00502210046363`,
725.2710796047526`}, {466.93036260189587`,
714.9222385113518`}}}, {{{463.10906833362026`,
705.8215365709461`}, {440.8338320897309`,
638.9330932471631`}}}, {{{704.5242626870805`,
366.9616871104964`}, {752.7463203658676`,
380.17657088689504`}}, {{770.106261130231`,
384.93392904639853`}, {784.5728784338672`,
388.89839417931813`}}, {{755.6396438265949`,
380.969463913479`}, {755.6396438265949`,
380.969463913479`}}}, {{{509.00073948327554`,
792.601812165756`}, {514.6036265393997`,
795.896908012058`}}, {{523.2234527795906`,
800.9662862371381`}, {569.3395231646122`,
828.0874597413163`}}, {{580.9762885888699`,
834.9311203451743`}, {591.3200800770991`,
841.0143742152703`}}}, {{{465.8535220251778`,
519.6253628345503`}, {473.1521455469121`,
507.09619308200945`}}, {{480.9541224149729`,
493.7029426568794`}, {508.13520311660403`,
447.0425863370716`}}, {{512.9170599067057`,
438.83381994747583`}, {516.188856657828`,
433.2172955756473`}}}, {{{605.3593557193665`,
846.892157696029`}, {617.9307161416536`,
850.2028822591651`}}, {{635.3372151878974`,
854.7869624235071`}, {678.3699489411111`,
866.1198272742419`}}, {{689.0072539138157`,
868.9212095968953`}, {693.3588786753767`,
870.067229637981`}}}, {{{508.21210834329105`,
441.32327256964817`}, {513.7874310508546`,
437.98174945787315`}}, {{522.7937215784572`,
432.58390443115974`}, {565.6808193289459`,
406.879880494429`}}, {{580.262432564112`,
398.14051235594053`}, {588.8398521142097`,
392.9997075685944`}}}, {{{945.0453081544204`,
615.3485245126913`}, {942.9491658930333`,
608.1474004601544`}}, {{940.1543095445172`,
598.5459017234383`}, {924.9223424451045`,
546.217733608336`}}, {{920.1710866526272`,
529.8951857559189`}, {915.8390593124273`,
515.012862714009`}}, {{924.0838855405497`,
543.3372839873211`}, {924.0838855405497`,
543.3372839873211`}}}, {{{891.0325764337999`,
769.5939985368944`}, {886.0684592873286`,
774.529334488591`}}, {{881.104342140857`,
779.4646704402875`}, {857.3474957970293`,
803.0837782091207`}}, {{850.2558998734986`,
810.1342581401157`}, {845.2917827270271`,
815.0695940918122`}}}, {{{442.88828917567344`,
604.4194667372232`}, {454.07330507843335`,
560.315663961782`}}, {{458.1294097464672`,
544.3219772410176`}, {461.2022163131595`,
532.2055479071053`}}, {{438.9550967703073`,
619.9284962846309`}, {440.0613071343165`,
615.5665817244225`}}, {{461.9396898891656`,
529.2976048669664`}, {461.9396898891656`,
529.2976048669664`}}}, {{{912.968724098682`,
724.7785143520076`}, {907.0206200325399`,
733.4312629337211`}}, {{901.9222451187039`,
740.8479045751898`}, {895.9741410525619`,
749.5006531569032`}}, {{888.8930647833452`,
759.8015443256098`}, {871.048752584919`,
785.7597900707502`}}}, {{{799.38719576434`,
838.0383521385287`}, {810.861653119809`,
830.9259103357774`}}, {{823.6110501814413`,
823.0231972216093`}, {863.1341810725012`,
798.5247865676884`}}, {{872.9087188197525`,
792.4660398468262`}, {875.8835781341334`,
790.6220734535203`}}}, {{{492.05116674564863`,
464.5314947377653`}, {497.00707777761914`,
459.5879185177407`}}, {{504.08695068043426`,
452.52566677484845`}, {527.8045249048648`,
428.86712343615943`}}, {{534.5304041625392`,
422.1579842804117`}, {539.8403088396504`,
416.86129547324265`}}}, {{{892.1352674415075`,
465.8555431860126`}, {886.8606781391678`,
460.5236853773643`}}, {{881.9377281236507`,
455.54728475595925`}, {859.4328137670013`,
432.79802477239326`}}, {{856.9713387592428`,
430.3098244616907`}, {853.4549458910163`,
426.7552525892586`}}, {{847.828717301854`,
421.06793759336705`}, {842.9057672863369`,
416.091536971962`}}}, {{{856.1287152741202`,
429.5556949687151`}, {825.373670744188`,
410.8440078197195`}}, {{810.85045527172`,
402.00793333269377`}, {799.3173135729954`,
394.9910506518204`}}, {{874.0691579165806`,
440.4708458056292`}, {871.0790841428371`,
438.6516539994768`}}}, {{{706.7688454705797`,
866.1155780183958`}, {715.8791630173511`,
863.422603046921`}}, {{727.3869325501149`,
860.020950451374`}, {764.7871835315974`,
848.965579515846`}}, {{778.2129146531553`,
844.9969848210411`}, {794.5155881579041`,
840.1779769773493`}}, {{693.3431143490219`,
870.0841727132007`}, {697.6585279238083`,
868.8085529898706`}}, {{723.0715189753284`,
861.2965701747041`}, {724.5099901669239`,
860.8713636002608`}}}, {{{494.062310857749`,
770.3689753167482`}, {497.9497825454709`,
774.259677551199`}}, {{505.0179128867835`,
781.3336816138369`}, {528.6961495301806`,
805.0315952236737`}}, {{534.7040603202963`,
811.0444986769159`}, {539.6517515592151`,
815.9963015207622`}}}, {{{517.1634841965435`,
795.6789694714448`}, {551.4209216971924`,
819.1028456641062`}}, {{561.326686757621`,
825.876014683671`}, {570.4069713963472`,
832.0847529516053`}}}, {{{602.0142539261672`,
387.243783784461`}, {614.5965454069391`,
383.97484801071255`}}, {{629.1145740385991`,
380.2029990410027`}, {656.698828438753`,
373.0364859985541`}}, {{669.7650542072471`,
369.6418219258152`}, {680.4116085371311`,
366.875799348028`}}, {{691.058162867015`,
364.10977677024084`}, {695.897505744235`,
362.85249378033757`}}, {{660.086368452807`,
372.1563879056217`}, {664.441777042305`,
371.0248332147088`}}}, {{{905.9199002037807`,
493.45496358432825`}, {900.0438762802721`,
484.75310499835047`}}, {{893.0486097046667`,
474.3937495388531`}, {872.0628099778505`,
443.315683160361`}}}, {{{935.6213140090215`,
664.6453250456834`}, {936.2842795249042`,
658.1792229180681`}}, {{938.3751707673033`,
637.7861315925124`}, {941.1290275255852`,
610.9269381393415`}}, {{942.148974473097`,
600.979088712241`}, {942.8119399889797`,
594.5129865846258`}}}, {{{876.1076320107848`,
447.8418696405944`}, {858.4831529239871`,
433.06426033059324`}}, {{855.8011669759961`,
430.8154936964627`}, {845.4563640337453`,
422.1416795362446`}}, {{835.8778427909205`,
414.1103701286353`}, {830.8970117446515`,
409.93408923667846`}}}, {{{477.96977243615703`,
739.5010003762118`}, {484.14074367653006`,
748.606993674611`}}, {{493.1167018443452`,
761.8520748359189`}, {514.1541038001619`,
792.895233807734`}}, {{518.9225815768137`,
799.9316831746788`}, {521.7275685042559`,
804.0707710375876`}}}, {{{478.0161120665802`,
492.38506823471084`}, {483.9210169803439`,
483.70278178703984`}}, {{492.9189673251266`,
470.47263100963653`}, {510.0713101698685`,
445.25265609021153`}}, {{490.95066568720534`,
473.3667264921935`}, {490.95066568720534`,
473.3667264921935`}}, {{512.0396118077897`,
442.35856060765457`}, {512.3207977560642`,
441.94511839586073`}}}, {{{485.1229000153161`,
477.42071111685743`}, {489.811587837629`,
471.5669767100968`}}, {{500.1267010467176`,
458.68876101522335`}, {517.3185563951986`,
437.22506819043406`}}, {{497.9386467296382`,
461.42050373837833`}, {497.9386467296382`,
461.42050373837833`}}, {{523.8827193464367`,
429.0298400209691`}, {526.3833528516702`,
425.9078483373635`}}}};
What I would like to be able to do is take each of the 50 lines in this list. extract their beginning and end points and place that into a single list which should have 100 points which will hopefully make it easier for me to do some of the image analysis im looking to do.
Is it possible to do this via an inbuilt method that im not finding in the documentation or is there something I need to write for this.
In response to those asking for a smaller data set I reran my edge detect with much fewer features. Heres a list of 5 relevant lines for expirimentation
lines2={{{{938.018, 641.694}, {934.882, 649.594}}, {{931.007,
659.353}, {899.825, 737.889}}, {{892.075, 757.407}, {887.462,
769.024}}, {{884.141, 777.389}, {881.558, 783.895}}, {{944.107,
626.358}, {943., 629.147}}}, {{{510.346, 794.025}, {506.987,
787.319}}, {{501.165, 775.696}, {468.921, 711.319}}, {{459.965,
693.437}, {453.023, 679.578}}}, {{{936., 663.703}, {930.85,
673.985}}, {{926.148, 683.373}, {917.863, 699.914}}, {{908.01,
719.585}, {881.812, 771.891}}, {{877.11, 781.279}, {873.751,
787.985}}, {{870.168, 795.138}, {868.825, 797.82}}}, {{{534.14,
420.13}, {546.616, 414.971}}, {{563.25, 408.093}, {638.565,
376.951}}, {{655.199, 370.073}, {668.137, 364.724}}}, {{{498.295,
777.833}, {493.064, 765.387}}, {{486.09, 748.793}, {453.93,
672.277}}, {{446.955, 655.683}, {442.887, 646.004}}}};
An example of part of what im looking for is what happens if i extract a single element of this list of lines:
ListPlot[lines[[1]]]
i get a nice line of data points but if i use:
ListPlot[{lines[[1]],lines[[2]]}]
i get nothing. additionally, to do what im looking for i would need to plot all 50 of these one one plot and then strip out the excess data points that arent the endpoints for each line
I was able to solve this using a looped join function like so:
Points = lines[[1]];
Do[Points = Join[Points, lines[[i]]], {i, 2, 50, 1}];
This joins each individual line segment set into one large list.
Answered by TheFarstrider on March 26, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP