Skip to content
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

Crashing, bad settings. #3

Open
everythingability opened this issue Dec 30, 2020 · 6 comments
Open

Crashing, bad settings. #3

everythingability opened this issue Dec 30, 2020 · 6 comments

Comments

@everythingability
Copy link

So both my style and target pic are 3000x2000 pixels.

My preset_xml is set to ...

  <sprite_w>1000</sprite_w>
  <sprite_n>6</sprite_n>

and yet it always crashes like this,

[3000 x 2000]x4
[3000 x 2000]x3
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: OpenCV(4.5.0) /tmp/opencv-20201123-26930-m95s1u/opencv-4.5.0/modules/core/src/matrix.cpp:473: error: (-215:Assertion failed) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function 'Mat'

Abort trap: 6

I am attempting to create images that are made of recognisable fragments, so I want my sprite width to be quite big, and for the target image to be recognisable, but part style image... a bit like this picture of David Cameron UK MP.
https://www.inprnt.com/gallery/everythingability/pigs-ears-3/

It's the halfwayness I like...

@everythingability
Copy link
Author

Which is correct isn't it?

width = 3000
height = 2000
u = 1000
(width/u)*(height/u)
6.0

@LingDong-
Copy link
Owner

Hi @everythingability,

Thanks for reporting this issue!

From the looks of it, I think it is because the sprite height is >= half of the canvas height, so one of the computed regions gets a height of zero, causing openCV to be unhappy.

Maybe try with canvas dimensions 3001 x 2001 ?

I will try to reproduce the issue when I get some time

@everythingability
Copy link
Author

The 3001 x 2001 trick didn't do it... this exr got made.. but then still...
test exr

settings file loaded.
[3001 x 2001]x4
[3001 x 2001]x3
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: OpenCV(4.5.0) /tmp/opencv-20201123-26930-m95s1u/opencv-4.5.0/modules/core/src/matrix.cpp:473: error: (-215:Assertion failed) 0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows in function 'Mat'

Just as note, why should I have to define   <sprite_n>24</sprite_n> ?  Basically if I say it is 400 then the code could figure out how to fit that in, left to right, top to bottom, on whatever sized image(s)... and if I chose to have bits missing, that's down to me. 



@LingDong-
Copy link
Owner

sprite_n is necessary because say you have 1021 sprites, you may want to do a grid of 3232=1024 and tell the program to omit the last 3 cells, instead of having a 11021 spritesheet.

@everythingability
Copy link
Author

Ah... yeah I get it... Would it be possible to generate a mask file, like the one above, then edit it manually... to create more irregular shapes (like jigsaw pieces) or even a thresholded photo.. then pass that in as a param, rather than those regular ellipses?

@everythingability
Copy link
Author

Here are my project files, not that I expect you have time, just in case it sheads light on things...

https://www-users.york.ac.uk/~tas509/pmst-project.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants