Home Python OpenCV: Reading an image along x and y axis
Reply: 0

Python OpenCV: Reading an image along x and y axis

user603
1#
user603 Published in July 20, 2018, 1:19 am

Aim: I am trying to read the first point (non-zero) here in this image (shown as the red arrow)

from __future__ import division
import numpy as np

import cv2
im1 = cv2.imread('C:/Users/Desktop/Line.png', 0)
for x in range(0, im1.shape[0], 1):
    for y in range(0, im1.shape[1], 1):
        cpt = im1[x][y]
        if 0 < cpt <= 255 :
           print("This is the value", x,y)

But, the point being printed is this (a zero point):

How is this so?

The original image:

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.306369 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO