Hi Surya,

Yes, test images would be helpful. My intuition without having test data is 
that you have some underflow errors in the numpy call, which cv2 avoids with 
some preprocessing:

In [1]: im0 = np.array([64], dtype=np.uint8)

In [2]: im1 = np.array([65], dtype=np.uint8)

In [3]: np.abs(im0 - im1)
Out[3]: array([255], dtype=uint8)

This is the correct implementation in NumPy:

In [6]: np.maximum(im0, im1) - np.minimum(im0, im1)
Out[6]: array([1], dtype=uint8)

Juan.

On 21 Apr 2017, 9:12 AM +1000, Surya Kasturi <sur...@udel.edu>, wrote:
> I’m sorry,
>
> Its
>
> >> np.abs(im1 - im2)
>
>
> Surya
>
>
>
>
>
>
> > On Apr 20, 2017, at 7:10 PM, Surya Kasturi <sur...@udel.edu> wrote:
> >
> > Hey,
> >
> > I’m doing absolute difference between two images and found that the results 
> > from opencv and scikit-image are different
> >
> > >> im1 = imread(“file1.jpg”)
> > >> im2 = imread(“file2.jpg”)
> > >>
> > >> cv2.absdiff(im1, im2)
> > >> np.abs(im1, im2)
> >
> > I was expecting exactly same result.. could anyone please let me know why 
> > I’m observing slightly different results.
> >
> > (I could post images if you’d like)
> >
> > Thanks
> > Surya
> >
>
> _______________________________________________
> scikit-image mailing list
> scikit-image@python.org
> https://mail.python.org/mailman/listinfo/scikit-image
_______________________________________________
scikit-image mailing list
scikit-image@python.org
https://mail.python.org/mailman/listinfo/scikit-image

Reply via email to