-
Notifications
You must be signed in to change notification settings - Fork 896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question About Mask Rotation #220
Comments
Hello @Brian417-cup, I'm not entirely sure I understand your question. As you've already shown with your examples, if we don't rotate the mask then the resulting mesh is incorrectly oriented. That seems like one answer to your question, but I assume it is not the one you are after. Could you please give me a little more context on what you mean and why you are asking this question? |
Okay, here are more details: regarding the triangulation process of the mask, I have separately take out the generated mesh function you provided:
and use the visualization function you provided to visualize the triangulation.:
At the beginning, I didn't notice that the input mask needs to be rotated first and just make the input mask have same adjusted width and height. Therefore, I got was the incorrect result you saw above. Then, I find in your source code have a rotation operation above. I wonder if the necessity of rotation operation is due to a process that transposes the image again during the subsequent triangulation process. Please forgive me for being a beginner in the field of graphics. |
In the Animated Drawings visualization code, the second dimension (the 'y' in [x, y, z]) cartesian coordinates) of a point defines its height. But when reading in an image using cv2, the resulting matrix has dimensions [nrows, ncols, nchannels]. Since the 'height' of a pixel in the image is determined by it's row, this information is contained in the first dimension. IIRC, the rotation is necessary to account for the mismatch between these two representations. |
I noticed that you had a 90 degree rotation operation on the mask before doing the mask triangulation patch.
AnimatedDrawings/animated_drawings/model/animated_drawing.py
Line 498 in c5c3bc7
And after I running your triangulation function, I found that if without this operation, it would not have obtained the correct result. I would like to know why this rotation operation is needed.
Here is initialization mask , my visualization results about rotation and withou rotation respectively:
![mask](https://private-user-images.githubusercontent.com/72691001/263890175-1b74925b-8c24-4560-b38d-25b8d3c13135.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3MTQwNjcsIm5iZiI6MTcyMTcxMzc2NywicGF0aCI6Ii83MjY5MTAwMS8y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bXotU2lnbmF0dXJlPWI0MjExOTcyZTQ1YjU3NmEyMGQzMzk3NDA0MjU2ZjdkYmFjZGYwZjk1OGEyMGJkMmE0NmViNTMzMTc1YjY3ODQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.MwKHK2Dq6XYTm61YTKv1REQlacF_gZzBdsLOc-cZCmw)
![wo_rotate](https://private-user-images.githubusercontent.com/72691001/263890196-516726e1-c4af-4de6-9fa9-c9bc4602c9db.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE3MTQwNjcsIm5iZiI6MTcyMTcxMzc2NywicGF0aCI6Ii83MjY5MTAwMS8yNjM4OTAxOTYtNTE2NzI2ZTEtYzRhZi00ZGU2LTlmYTktYzliYzQ2MDJjOWRiLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIzVDA1NDkyN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI5ZThjMTA5MWU0ZDM0Zjk4YThkMzZkMjQ0ZGNlOWNiNzI4MDEyYjYzNzM4NzdmYTNkZWFhMTdjOTFiYWY0MzkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.D9vLijjlvHsgStOhJ1kWnOPXsfS0qp8gTy3HVHBW7C8)
The text was updated successfully, but these errors were encountered: