Simple image comparing program using pyside

92 views
Skip to first unread message

Hyuk Ko

unread,
Aug 10, 2018, 2:08:17 AM8/10/18
to Python Programming for Autodesk Maya
Hello!

I am trying to make a simple image comparing program in maya


I looks like a really easy job by using OpenCV and numpy

Tried to install these packages in maya, and failed HARD... (first time installing outer packages to maya... not easy as it sounds)

Is it possible to make a similar program by using pyside?

Thanks in advance!



Marcus Ottosson

unread,
Aug 10, 2018, 2:12:31 AM8/10/18
to python_in...@googlegroups.com
You can install OpenCV and NumPy into Maya, but it can't be the packages distributed via their standard installers or `pip` as they need to have been compiled especially for your version of Maya, such as 2018.

Do a Google for pre-compiled versions for your platform and version of Maya, I've seen those around.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/32958bc8-30cb-4afd-b93b-55e1e849a870%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Justin Israel

unread,
Aug 10, 2018, 3:37:51 AM8/10/18
to python_in...@googlegroups.com
It doesn't look like that demo is using OpenCV for more than just reading and decoding images into byte arrays. And then a difference between the byte arrays is used to determine if the images are the same. Seems you could probably do the same thing with PySide using QImage 


It defines a similar subtraction operator that says it first checks cast stuff like width/height and then would do a data comparison. 

Im sure OpenCV *could* be used to do more advanced stuff like checking if the images are different within certain thresholds to allow for stuff like noise. Or evaluating if the images are generally of the same subject. And also, you would probably get a wider support of file formats with OpenCV. 

If you don't want to have to compile OpenCV and numpy, and your goal is purely to check the difference, then there is always the option to shell out from your script to something like idiff (provided by OpenImageIO) or whatever other diff tools exist. 

Justin 


Hyuk Ko

unread,
Aug 10, 2018, 12:54:12 PM8/10/18
to Python Programming for Autodesk Maya
Thank you for helping me out!

I found PIL might be just the right solution for me

def check_equal(imgA, imgB):
    return ImageChops.difference(img1, img2).getbbox() is None

These two lines solved my problems!


2018년 8월 10일 금요일 오후 4시 37분 51초 UTC+9, Justin Israel 님의 말:
It doesn't look like that demo is using OpenCV for more than just reading and decoding images into byte arrays. And then a difference between the byte arrays is used to determine if the images are the same. Seems you could probably do the same thing with PySide using QImage 


It defines a similar subtraction operator that says it first checks cast stuff like width/height and then would do a data comparison. 

Im sure OpenCV *could* be used to do more advanced stuff like checking if the images are different within certain thresholds to allow for stuff like noise. Or evaluating if the images are generally of the same subject. And also, you would probably get a wider support of file formats with OpenCV. 

If you don't want to have to compile OpenCV and numpy, and your goal is purely to check the difference, then there is always the option to shell out from your script to something like idiff (provided by OpenImageIO) or whatever other diff tools exist. 

Justin 
On Fri, Aug 10, 2018, 6:08 PM Hyuk Ko <kohyu...@gmail.com> wrote:
Hello!

I am trying to make a simple image comparing program in maya


I looks like a really easy job by using OpenCV and numpy

Tried to install these packages in maya, and failed HARD... (first time installing outer packages to maya... not easy as it sounds)

Is it possible to make a similar program by using pyside?

Thanks in advance!



--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages