Answer the question
In order to leave comments, you need to log in
How to find a shape inside a 2D Numpy array while having an outline?
I have a shape contour - cnt, I need to find it inside a two-dimensional array, I have a target_index variable, it is used to find the required zone, but I need to find the cnt contour zone in it.
import numpy as np
x = np.linspace(0,1000, int(1000/50))
y = np.linspace(0,1000, int(1000/50))
X,Y = np.meshgrid(x,y)
source = np.column_stack([X.ravel(), Y.ravel()]).astype(int)
destination = source.copy()
#cnt =
# Need to use cnt here
target_index = np.where(np.logical_and(destination[:,1]==789,destination[:,0]>=421))
destination[target_index]
scope = destination[target_index]
scope[:,0] = scope[:,0] + 10
destination[target_index] = scope
destination[target_index]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question