I am new to using OpenMV but I am having a few difficulties. I hope you guys can help give me some advice. I am struggling to transfer my python code in analysing the image to the device. At the moment I am stuck with extracting the pixel value in the image. I tried different approaches but keep getting error messages. Here is part of the code in python that I want to implement on the device:
img = Image.open(‘Image1.jpg’)
img1 = img.crop((175, 0, 245, 180))
image_size = img1.size
analysed_array = zeros([image_size,1])
for i in range(0, image_size):
for j in range(0, image_size):
analysed_array[i,0] = analysed_array[i,0] + pix[j,i]
In this example code I am reading in the image taken from the camera on my computer. I want to convert the i by j array of the cropped image to a i by 1 array by summing along the x-axis (horizontal). This section of the code works well on python and I get the result I want but when I transfer this to OpenMV device I get errors for using “zeros” and “image.load()”. I am stuck and not sure how to proceed. What I want to achieve is finding the pixel value of each i and j position.
Hope you guys can help and guide on how to achieve my goal.
Thank you so much