mohammaduzair9 / basic-image-processing Goto Github PK
View Code? Open in Web Editor NEWImplementation of Basic Digital Image Processing Tasks in Python / OpenCV
Implementation of Basic Digital Image Processing Tasks in Python / OpenCV
def calculateTransitions(im):
h, w = im.shape[0], im.shape[1]
prev = im[0,0]
n = 0
for x in range(1, h):
for y in range(1, w):
curr = im[x,y]
# check if the is black to white transition
n = n+1 if curr == 255 and prev == 0 else n
prev = curr
return n
There is something wrong with
n = n+1 if curr == 255 and prev == 0 else n
prev = curr
return n
this part
please solve getting the same error
NameError Traceback (most recent call last)
in
54 return n
55
---> 56 boundingBox = findBB(binary)
57 cropImg = binary[boundingBox[0]:boundingBox[1], boundingBox[2]:boundingBox[3]]
58 centroid = findCentroid(cropImg)
in findBB(im)
10 right, bottom = 0, 0
11
---> 12 for x in xrange(h):
13 for y in xrange(w):
14 if (im[x,y] == 0):
NameError: name 'xrange' is not defined
ValueError Traceback (most recent call last)
in
55 return n
56
---> 57 boundingBox = findBB(binary)
58 cropImg = binary[boundingBox[0]:boundingBox[1], boundingBox[2]:boundingBox[3]]
59 centroid = findCentroid(cropImg)
in findBB(im)
13 for x in range(h):
14 for y in range(w):
---> 15 if (im[x,y] == 0):
16 right = x if x > right else right
17 left = x if x < left else left
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
I have tried a lot but still not able to solve this error. Please help
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.