使用numpy在2D图像数组中进行Logical_And

时间:2019-07-18 04:18:06

标签: python-3.x numpy image-processing pixel logical-operators

我有2个图像数组,我试图执行“逻辑与”,但是Numpy中的logical_and运算符不能为我生成正确的图像。它只是给我一个黑色的图像。

以下是代码段

    # iterating  an array the BIG O will be O(n^2)
    for x in range(0, height1-1):
        for y in range(0, width1-1):
            image1X = image1.getpixel((x, y))
            image2X = image2.getpixel((x, y))
            imageArrayTemp[y][x] = image1X and image2X

这很完美,但是当我尝试这个

     intesect_array = np.logical_and(imageArray1,imageArray2)

并转换回图像,则无法获得上述结果。这两个人不是应该做同样的事情吗?

请您指导一下。

0 个答案:

没有答案