Momocs icon indicating copy to clipboard operation
Momocs copied to clipboard

Some first points going in reverse - PCA shapes messed up afterward

Open JehanLC opened this issue 1 year ago • 3 comments

Hello !

I started using Momocs just recently. I am working with shapes, precisely the right half of individuals, so the left side is simply a straight line.

De facto it is much more easier to center, scale and select the direction of following analyses. All the first points are well-centered and on the axis. However, after coo_slidedirection(my_coo, "left"), some of my first points are pointing toward a direction opposite from other first points. When doing my PCA some of the shapes present "wiggly" left sides, which is not "normal" when considering the initial shapes...

I don't know how to change the direction of these points. I think it is an easy and quick correction but I can't find anything on the internet... thanks for the help !

JehanLC avatar Sep 05 '23 07:09 JehanLC

Hi there,

usually, some coo_flipy(or x) %>% coo_rev does the job for flipped shapes ;-)

Le mar. 5 sept. 2023 à 09:07, JehanLC @.***> a écrit :

Hello !

I started using Momocs just recently. I am working with shapes, precisely the right half of individuals, so the left side is simply a straight line.

De facto it is much more easier to center, scale and select the direction of following analyses. All the first points are well-centered and on the axis. However, after coo_slidedirection(my_coo, "left"), some of my first points are pointing toward a direction opposite from other first points. When doing my PCA some of the shapes present "wiggly" left sides, which is not "normal" when considering the initial shapes...

I don't know how to change the direction of these points. I think it is an easy and quick correction but I can't find anything on the internet... thanks for the help !

— Reply to this email directly, view it on GitHub https://github.com/MomX/Momocs/issues/232, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECQFWORXEBKAWRWW3ZNADXY3FU5ANCNFSM6AAAAAA4LJPQQY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- vincentbonhomme.fr http://www.vincentbonhomme.fr cevennette.fr https://www.cevennette.fr 🌱

vbonhomme avatar Sep 05 '23 13:09 vbonhomme

Hello,

Thank you for the help, so after trying to correct this problem it seems that the problem wasn't really a "flipped" shape.

To summarize, the base of the analysis was: importing jpg (right side shapes) into the coo object, followed by coo_center / coo_scale / coo_slidedirection(coo_object, direction = "left"). All of the starting points were well-centered, but a few ones (1-2% error rate) instead of "going up" for the analysis were "going down".

At the end it was finally corrected by multiple importing attempts (import_jpg), sometimes it randomly works ! 👍

Kind regards, Jéhan

JehanLC avatar Sep 07 '23 09:09 JehanLC

about the last part "randomly works": any chance that the mask was not centered on the black/white images? if so, import_jpg() tries to find a black point by picking random pixels in the image. that should be corrected in the next versions of Momocs (still dont know when though...)

Le jeu. 7 sept. 2023 à 11:30, JehanLC @.***> a écrit :

Hello,

Thank you for the help, so after trying to correct this problem it seems that the problem wasn't really a "flipped" shape.

To summarize, the base of the analysis was: importing jpg (right side shapes) into the coo object, followed by coo_center / coo_scale / coo_slidedirection(coo_object, direction = "left"). All of the starting points were well-centered, but a few ones (1-2% error rate) instead of "going up" for the analysis were "going down".

At the end it was finally corrected by multiple importing attempts (import_jpg), sometimes it randomly works ! 👍

Kind regards, Jéhan

— Reply to this email directly, view it on GitHub https://github.com/MomX/Momocs/issues/232#issuecomment-1709810466, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABECQFXSLIML537QYPEOOI3XZGH2HANCNFSM6AAAAAA4LJPQQY . You are receiving this because you commented.Message ID: @.***>

-- vincentbonhomme.fr http://www.vincentbonhomme.fr cevennette.fr https://www.cevennette.fr 🌱

vbonhomme avatar Sep 07 '23 09:09 vbonhomme