Modifying code to record multiple particles in the y-axis

Viewed 35

I am very new to Python coding and have been asked to attempt modifying a pre-made code for image analysis.

Any suggestions for modifying the below code to record the distance between particles only in the y-axis?

The code is

import numpy as np

import cv2

import csv

import glob

import multiprocessing

import concurrent.futures

images =[cv2.imread(image_in_file) for image_in_file in glob.glob("*.tif")]


def particle_gradient(img):

x = ['x']

y=['y]

for i in range(np.shape(img)[1]:

count = 0 

for j in range(np.shape(img)[0]):

if 0 < img[j][i][0] < 100:

count +=1 

elif img[j][i][0] >= 100:

x.append(round(i/63, 4))

y.append(-round(count/63, 4)) 

break

coord = [x, y]

return coord

Also I left out the last part about transferring the data to an excel worksheet, I assume that won't have to change.

Also I tried looking up similar coding questions or problems but couldn't find anything online.

Thanks guys!

0 Answers
Related