-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
modifying colored_img_generator to loop over known colors. #100
Conversation
Thanks! Can we keep the error message anyway? |
Or what exactly is idx%len(colors) doing? Just repeating the first color after the last one is reached? |
Yes of course we can keep the message, I'm going to add a couple of lines to make it even better. idx%len(colors) means that, for a given tuple "colors", if the number of images is longer than this tuple length, it will repeat from the first color. By the way, thank you for this insane package ! |
I have added a warning message, with instructions for those who wish to add their own colours. Otherwise, it loops the default colors. Let me know if anything is missing, or if you need anything else ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for reaching out to fix this for many images. Clever idea with the use of Modulo for repeating colors. Sorry for the bad formatting, im on the Smartphone
stitching/seam_finder.py
Outdated
corners, | ||
sizes, | ||
colors=( | ||
(255, 000, 000), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we leave the comments which code is which color?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But yes I think its a good idea having this as a parameter
stitching/seam_finder.py
Outdated
), # Orange | ||
): | ||
def colored_img_generator(sizes, colors): | ||
if type(colors) is not tuple: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to remove this check. I understand why one might check the contract but I dont do it somewhere else so I want to stay constant
stitching/seam_finder.py
Outdated
) | ||
|
||
if len(sizes) + 1 > len(colors): | ||
print( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use StitchingWarning from https://github.com/OpenStitching/stitching/blob/main/stitching/stitching_error.py instead of print. I would like to remove this part: ```
Please add additional colors in a tuple.\n
Example of use : colors=((255, 000, 000), (000, 255, 255)).\n
I would like to change to 'Without additional colors, there will be seam masks with identical colors'
stitching/seam_finder.py
Outdated
|
||
|
||
def create_img_by_size(size, color=(0, 0, 0)): | ||
def create_img_by_size(size, color): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please leave the default since it would be a breaking change
I have now corrected all your requests, tell me if everything is correct now ! |
Thanks a lot! :) |
Before this correction, the function raised "ValueError("Not enough default colors! Pass additional " 'colors to "colors" parameter')", but we couldn't pass additional colors.
To avoid this problem and to make it easier, the correction takes the 9 known colors (Blue, Red, Green, Yellow, Magenta, Pink, Gray, Brown, Orange), and loop over them if needed.