pmst icon indicating copy to clipboard operation
pmst copied to clipboard

Crashing, bad settings.

Open everythingability opened this issue 5 years ago • 6 comments

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 avatar Dec 30 '20 20:12 everythingability

Which is correct isn't it?

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

everythingability avatar Dec 30 '20 20:12 everythingability

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

LingDong- avatar Dec 30 '20 22:12 LingDong-

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. 



everythingability avatar Dec 31 '20 10:12 everythingability

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.

LingDong- avatar Dec 31 '20 19:12 LingDong-

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 avatar Jan 01 '21 09:01 everythingability

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

everythingability avatar Jan 01 '21 09:01 everythingability