Loading autocnet/graph/network.py +1 −1 Original line number Diff line number Diff line Loading @@ -1578,7 +1578,7 @@ class NetworkCandidateGraph(CandidateGraph): time=walltime, partition=self.config['cluster']['queue'], output=self.config['cluster']['cluster_log_dir']+f'/autocnet.{function}-%j') submitter.submit(array='1-{}%24'.format(job_counter), chunksize=chunksize) submitter.submit(array='1-{}%25'.format(job_counter), chunksize=chunksize) return job_counter def generic_callback(self, msg): Loading autocnet/io/db/model.py +15 −9 Original line number Diff line number Diff line Loading @@ -359,14 +359,20 @@ class Measures(BaseMixin, Base): imageid = Column(Integer, ForeignKey('images.id')) serial = Column("serialnumber", String, nullable=False) _measuretype = Column("measureType", IntEnum(MeasureType), nullable=False) # [0,3] # Enum as above ignore = Column("measureIgnore", Boolean, default=False) sample = Column(Float, nullable=False) line = Column(Float, nullable=False) template_metric = Column("templateMetric", Float) template_shift = Column("templateShift", Float) phase_error = Column("phaseError", Float) phase_diff = Column("phaseDiff", Float) phase_shift = Column("phaseShift", Float) choosername = Column("ChooserName", String) apriorisample = Column(Float) aprioriline = Column(Float) sampler = Column(Float) # Sample Residual liner = Column(Float) # Line Residual ignore = Column("measureIgnore", Boolean, default=False) jigreject = Column("measureJigsawRejected", Boolean, default=False) # jigsaw rejected aprioriline = Column(Float) apriorisample = Column(Float) samplesigma = Column(Float) linesigma = Column(Float) weight = Column(Float, default=None) Loading autocnet/matcher/subpixel.py +49 −22 Original line number Diff line number Diff line Loading @@ -410,7 +410,7 @@ def iterative_phase(sx, sy, dx, dy, s_img, d_img, size=(51, 51), reduction=11, c dist = np.linalg.norm([dsample-dx, dline-dy]) if min(size) < 1: return None, None, None return None, None, (None, None) if delta_dx <= convergence_threshold and\ delta_dy<= convergence_threshold and\ abs(dist) <= max_dist: Loading Loading @@ -513,13 +513,20 @@ def geom_match(base_cube, input_cube, bcenter_x, bcenter_y, size_x=60, size_y=60 if phase_kwargs: resphase = iterative_phase(size_x, size_y, restemplate[0], restemplate[1], base_arr, dst_arr, **phase_kwargs) _,_,maxcorr, corrmap = restemplate x,y,_ = resphase _,_,maxcorr, temp_corrmap = restemplate x,y,(perror, pdiff) = resphase if x is None or y is None: return None, None, None, None, None temp_dist = np.linalg.norm([size_x-restemplate[0], size_y-restemplate[1]]) phase_dist = np.linalg.norm([restemplate[0]-resphase[0], restemplate[1]-resphase[1]]) dist = (temp_dist, phase_dist) metric = (restemplate[2], perror, pdiff) else: x,y,maxcorr,corrmap = restemplate x,y,maxcorr,temp_corrmap = restemplate if x is None or y is None: return None, None, None, None, None metric = maxcorr dist = np.linalg.norm([size_x/2-x, size_y/2-y]) sample, line = affine([x,y])[0] sample += start_x Loading @@ -537,11 +544,11 @@ def geom_match(base_cube, input_cube, bcenter_x, bcenter_y, size_x=60, size_y=60 axs[0].scatter(x=[base_arr.shape[1]/2], y=[base_arr.shape[0]/2], s=10, c="red") axs[0].set_title("Base") pcm = axs[2].imshow(corrmap**2, interpolation=None, cmap="coolwarm") pcm = axs[2].imshow(temp_corrmap**2, interpolation=None, cmap="coolwarm") plt.show() dist = np.linalg.norm([center_x-sample, center_y-line]) return sample, line, dist, maxcorr, corrmap # dist = np.linalg.norm([center_x-sample, center_y-line]) return sample, line, dist, metric, temp_corrmap def subpixel_register_measure(measureid, Loading Loading @@ -669,6 +676,12 @@ def subpixel_register_point(pointid, iterative_phase_kwargs={}, measures = session.query(Measures).filter(Measures.pointid == pointid).order_by(Measures.id).all() source = measures[0] source.template_metric = 1 source.template_shift = 0 source.phase_error = 0 source.phase_diff = 0 source.phase_shift = 0 sourceid = source.imageid res = session.query(Images).filter(Images.id == sourceid).one() source_node = NetworkNode(node_id=sourceid, image_path=res.path) Loading @@ -687,7 +700,7 @@ def subpixel_register_point(pointid, iterative_phase_kwargs={}, destination_node = NetworkNode(node_id=destinationid, image_path=res.path) destination_node.parent = ncg new_x, new_y, dist, template_metric, _ = geom_match(source_node.geodata, destination_node.geodata, new_x, new_y, dist, metric, _ = geom_match(source_node.geodata, destination_node.geodata, source.sample, source.line, template_kwargs=subpixel_template_kwargs, phase_kwargs=iterative_phase_kwargs, size_x=100, size_y=100) Loading @@ -697,7 +710,8 @@ def subpixel_register_point(pointid, iterative_phase_kwargs={}, currentlog['status'] = 'Failed to geom match.' resultlog.append(currentlog) continue cost = cost_func(dist, template_metric) # cost = cost_func(dist, template_metric) cost = 1 if cost <= threshold: measure.ignore = True # Threshold criteria not met Loading @@ -705,10 +719,23 @@ def subpixel_register_point(pointid, iterative_phase_kwargs={}, resultlog.append(currentlog) continue if iterative_phase_kwargs: print('subpixel_register_point -> PHASE MEASURE WRITE OUT') measure.template_metric = metric[0] measure.template_shift = dist[0] measure.phase_error = metric[1] measure.phase_diff = metric[2] measure.phase_shift = dist[1] else: print('subpixel_register_point -> NO PHASE MEASURE WRITE OUT') measure.template_metric = metric measure.template_shift = dist # Update the measure measure.sample = new_x measure.line = new_y measure.weight = cost measure.choosername = 'subpixel_register_point' # In case this is a second run, set the ignore to False if this # measures passed. Also, set the source measure back to ignore=False Loading autocnet/spatial/overlap.py +11 −10 Original line number Diff line number Diff line Loading @@ -254,7 +254,8 @@ def place_points_in_overlap(overlap, aprioriline=line, imageid=node['node_id'], serial=node.isis_serial, measuretype=3)) measuretype=3, choosername='place_points_in_overlap')) if len(point.measures) >= 2: points.append(point) Loading Loading
autocnet/graph/network.py +1 −1 Original line number Diff line number Diff line Loading @@ -1578,7 +1578,7 @@ class NetworkCandidateGraph(CandidateGraph): time=walltime, partition=self.config['cluster']['queue'], output=self.config['cluster']['cluster_log_dir']+f'/autocnet.{function}-%j') submitter.submit(array='1-{}%24'.format(job_counter), chunksize=chunksize) submitter.submit(array='1-{}%25'.format(job_counter), chunksize=chunksize) return job_counter def generic_callback(self, msg): Loading
autocnet/io/db/model.py +15 −9 Original line number Diff line number Diff line Loading @@ -359,14 +359,20 @@ class Measures(BaseMixin, Base): imageid = Column(Integer, ForeignKey('images.id')) serial = Column("serialnumber", String, nullable=False) _measuretype = Column("measureType", IntEnum(MeasureType), nullable=False) # [0,3] # Enum as above ignore = Column("measureIgnore", Boolean, default=False) sample = Column(Float, nullable=False) line = Column(Float, nullable=False) template_metric = Column("templateMetric", Float) template_shift = Column("templateShift", Float) phase_error = Column("phaseError", Float) phase_diff = Column("phaseDiff", Float) phase_shift = Column("phaseShift", Float) choosername = Column("ChooserName", String) apriorisample = Column(Float) aprioriline = Column(Float) sampler = Column(Float) # Sample Residual liner = Column(Float) # Line Residual ignore = Column("measureIgnore", Boolean, default=False) jigreject = Column("measureJigsawRejected", Boolean, default=False) # jigsaw rejected aprioriline = Column(Float) apriorisample = Column(Float) samplesigma = Column(Float) linesigma = Column(Float) weight = Column(Float, default=None) Loading
autocnet/matcher/subpixel.py +49 −22 Original line number Diff line number Diff line Loading @@ -410,7 +410,7 @@ def iterative_phase(sx, sy, dx, dy, s_img, d_img, size=(51, 51), reduction=11, c dist = np.linalg.norm([dsample-dx, dline-dy]) if min(size) < 1: return None, None, None return None, None, (None, None) if delta_dx <= convergence_threshold and\ delta_dy<= convergence_threshold and\ abs(dist) <= max_dist: Loading Loading @@ -513,13 +513,20 @@ def geom_match(base_cube, input_cube, bcenter_x, bcenter_y, size_x=60, size_y=60 if phase_kwargs: resphase = iterative_phase(size_x, size_y, restemplate[0], restemplate[1], base_arr, dst_arr, **phase_kwargs) _,_,maxcorr, corrmap = restemplate x,y,_ = resphase _,_,maxcorr, temp_corrmap = restemplate x,y,(perror, pdiff) = resphase if x is None or y is None: return None, None, None, None, None temp_dist = np.linalg.norm([size_x-restemplate[0], size_y-restemplate[1]]) phase_dist = np.linalg.norm([restemplate[0]-resphase[0], restemplate[1]-resphase[1]]) dist = (temp_dist, phase_dist) metric = (restemplate[2], perror, pdiff) else: x,y,maxcorr,corrmap = restemplate x,y,maxcorr,temp_corrmap = restemplate if x is None or y is None: return None, None, None, None, None metric = maxcorr dist = np.linalg.norm([size_x/2-x, size_y/2-y]) sample, line = affine([x,y])[0] sample += start_x Loading @@ -537,11 +544,11 @@ def geom_match(base_cube, input_cube, bcenter_x, bcenter_y, size_x=60, size_y=60 axs[0].scatter(x=[base_arr.shape[1]/2], y=[base_arr.shape[0]/2], s=10, c="red") axs[0].set_title("Base") pcm = axs[2].imshow(corrmap**2, interpolation=None, cmap="coolwarm") pcm = axs[2].imshow(temp_corrmap**2, interpolation=None, cmap="coolwarm") plt.show() dist = np.linalg.norm([center_x-sample, center_y-line]) return sample, line, dist, maxcorr, corrmap # dist = np.linalg.norm([center_x-sample, center_y-line]) return sample, line, dist, metric, temp_corrmap def subpixel_register_measure(measureid, Loading Loading @@ -669,6 +676,12 @@ def subpixel_register_point(pointid, iterative_phase_kwargs={}, measures = session.query(Measures).filter(Measures.pointid == pointid).order_by(Measures.id).all() source = measures[0] source.template_metric = 1 source.template_shift = 0 source.phase_error = 0 source.phase_diff = 0 source.phase_shift = 0 sourceid = source.imageid res = session.query(Images).filter(Images.id == sourceid).one() source_node = NetworkNode(node_id=sourceid, image_path=res.path) Loading @@ -687,7 +700,7 @@ def subpixel_register_point(pointid, iterative_phase_kwargs={}, destination_node = NetworkNode(node_id=destinationid, image_path=res.path) destination_node.parent = ncg new_x, new_y, dist, template_metric, _ = geom_match(source_node.geodata, destination_node.geodata, new_x, new_y, dist, metric, _ = geom_match(source_node.geodata, destination_node.geodata, source.sample, source.line, template_kwargs=subpixel_template_kwargs, phase_kwargs=iterative_phase_kwargs, size_x=100, size_y=100) Loading @@ -697,7 +710,8 @@ def subpixel_register_point(pointid, iterative_phase_kwargs={}, currentlog['status'] = 'Failed to geom match.' resultlog.append(currentlog) continue cost = cost_func(dist, template_metric) # cost = cost_func(dist, template_metric) cost = 1 if cost <= threshold: measure.ignore = True # Threshold criteria not met Loading @@ -705,10 +719,23 @@ def subpixel_register_point(pointid, iterative_phase_kwargs={}, resultlog.append(currentlog) continue if iterative_phase_kwargs: print('subpixel_register_point -> PHASE MEASURE WRITE OUT') measure.template_metric = metric[0] measure.template_shift = dist[0] measure.phase_error = metric[1] measure.phase_diff = metric[2] measure.phase_shift = dist[1] else: print('subpixel_register_point -> NO PHASE MEASURE WRITE OUT') measure.template_metric = metric measure.template_shift = dist # Update the measure measure.sample = new_x measure.line = new_y measure.weight = cost measure.choosername = 'subpixel_register_point' # In case this is a second run, set the ignore to False if this # measures passed. Also, set the source measure back to ignore=False Loading
autocnet/spatial/overlap.py +11 −10 Original line number Diff line number Diff line Loading @@ -254,7 +254,8 @@ def place_points_in_overlap(overlap, aprioriline=line, imageid=node['node_id'], serial=node.isis_serial, measuretype=3)) measuretype=3, choosername='place_points_in_overlap')) if len(point.measures) >= 2: points.append(point) Loading