Open Love-Studyyy opened 3 years ago
Hi, I will answer you today or tomorrow 😉
Hi, thank you very much! It is very helpful! I’ve successfully converted png to json the day before yesterday morning. But I messed version of packages. It's been a failure till now
“cv.findcontours” can't find contours and hierarchy return "(0,0,0,0)"
What is your data collection?
png images are 8-bit depth gray images jpeg images are 24-bit depth RGB images
To correct this, “cv.findcontours” can't find contours and hierarchy return "(0,0,0,0)", are you modified correctly the json file "parameter", with the correct level of grey (in color option of each labels? Because my code work normally on RGB images as png
Do you mean png images are RGB format?
yes one of my png
each color is a label, you can in grey, but you need to define each label to correspond at an intensity of grey (warning, it is not turple of value but 1D in json files if you use grey color)
to test easilier, you can comment the two last line of the code and use :" # for j in range(l): image_to_json_partial(j)"
A solution for you if intensity of grey = the label number _mask=(image_label == categoryid).all(-1)
You are so enthusiastic! Thank you very much! I'm trying!
BE careful, i know, for example the png of citymap have a little image frame around, if it is it, you need to resize image of label and jpeg before to delete it. (it can explain the error you get “cv.findcontours” can't find contours and hierarchy return "(0,0,0,0)")
Good luck
ok, thanks a lot! And the version of packages can you list?😉 like: opencv, numpy, shapely ..
numpy 1.20.2 opencv-python 4.5.2.54 python 3.8.10 scipy 1.7.0 scikit-image 0.18.1 shapely 1.7.1 tqdm 4.61.1
I have updated the code, now it works with updated package
Thank you so much!😉 you are very enthusiastic and patient! good luck to you!!
Can you list the corresponding version of dependent packages? I guess it influences a lot.