@Override public void processBorder( int c_x , int c_y , TupleDesc_B feature ) { Arrays.fill(feature.data, 0); int index = image.startIndex + image.stride*c_y + c_x; for( int i = 0; i < definition.compare.length; i += 32 ) { int end = Math.min(definition.compare.length,i+32); int desc = 0; for( int j = i; j < end; j++ ) { Point2D_I32 c = definition.compare[j]; Point2D_I32 p_a = definition.samplePoints[c.x]; Point2D_I32 p_b = definition.samplePoints[c.y]; if( image.isInBounds(p_a.x + c_x , p_a.y + c_y) && image.isInBounds(p_b.x + c_x , p_b.y + c_y) ){ float valA = image.data[index + offsetsA[j]]; float valB = image.data[index + offsetsB[j]]; desc *= 2; if( valA < valB ) { desc += 1; } } } feature.data[ i/32 ] = desc; } }
private void check( int x , int y , float color0 , int indexA, GrayF32 input , FastQueue<Edge> edges ) { if( !input.isInBounds(x,y) ) return; int indexSrc = input.startIndex + y*input.stride + x; int indexB = + y*input.width + x; float colorN = input.data[indexSrc]; Edge e1 = edges.grow(); e1.sortValue = (float)Math.abs(color0-colorN); e1.indexA = indexA; e1.indexB = indexB; }
private void check( int x , int y , float color0 , int indexA, GrayF32 input , FastQueue<Edge> edges ) { if( !input.isInBounds(x,y) ) return; int indexSrc = input.startIndex + y*input.stride + x; int indexB = + y*input.width + x; float colorN = input.data[indexSrc]; Edge e1 = edges.grow(); e1.sortValue = (float)Math.abs(color0-colorN); e1.indexA = indexA; e1.indexB = indexB; }
/** * Takes the detected point along the line and its gradient and converts it into transform space. * @param x point in image. * @param y point in image. * @param derivX gradient of point. * @param derivY gradient of point. */ public void parameterize( int x , int y , float derivX , float derivY ) { // put the point in a new coordinate system centered at the image's origin // this minimizes error, which is a function of distance from origin x -= originX; y -= originY; float v = (x*derivX + y*derivY)/(derivX*derivX + derivY*derivY); // finds the foot a line normal equation and put the point into image coordinates int x0 = (int)(v*derivX) + originX; int y0 = (int)(v*derivY) + originY; if( transform.isInBounds(x0,y0)) { int index = transform.startIndex+y0*transform.stride+x0; // keep track of candidate pixels so that a sparse search can be done // to detect lines if( transform.data[index]++ == 1 ) candidates.add(x0,y0); } }
/** * Returns the value of the specified pixel. * * @param x pixel coordinate. * @param y pixel coordinate. * @return Pixel intensity value. */ public float get(int x, int y) { if (!isInBounds(x, y)) throw new ImageAccessException("Requested pixel is out of bounds: ( " + x + " , " + y + " )"); return unsafe_get(x,y); }
/** * Sets the value of the specified pixel. * * @param x pixel coordinate. * @param y pixel coordinate. * @param value The pixel's new value. */ public void set(int x, int y, float value) { if (!isInBounds(x, y)) throw new ImageAccessException("Requested pixel is out of bounds: "+x+" "+y); unsafe_set(x,y,value); }
public void set( int x , int y , float val ) { if( image.isInBounds(x,y) ) image.set(x,y,val); setOutside(x,y,val); }
public float get( int x , int y ) { if( image.isInBounds(x,y) ) return image.get(x,y); return getOutside( x , y ); }
/** * Checks to see if the given coordinate is above the lower threshold. If it is the point will be * added to the current segment or be the start of a new segment. * * @param parent The edge segment which is being checked * @param match Has a match to the current segment already been found? * @return true if a match was found at this point */ private boolean check( int x , int y , EdgeSegment parent , boolean match ) { if( intensity.isInBounds(x,y) ) { int index = intensity.getIndex(x,y); if( intensity.data[index] >= lower ) { intensity.data[index] = MARK_TRAVERSED; if( !match ) { Point2D_I32 p = queuePoints.grow(); p.set(x,y); parent.points.add(p); } else { // a match was found so it can't just be added to the current edge startNewSegment(x,y,parent); } return true; } } return false; }
if( intensity.isInBounds(fx,fy) && intensity.data[ indexForward ] >= lower ) { intensity.data[ indexForward ] = MARK_TRAVERSED; p = queuePoints.grow(); if( intensity.isInBounds(bx,by) && intensity.data[ indexBackward ] >= lower ) { intensity.data[ indexBackward ] = MARK_TRAVERSED; if( match ) {
/** * Checks to see if the given coordinate is above the lower threshold. If it is the point will be * added to the current segment or be the start of a new segment. * * @param match Has a match to the current segment already been found? * @return true if a match was found at this point */ private boolean check( int x , int y , boolean match ) { if( intensity.isInBounds(x,y) ) { int index = intensity.getIndex(x,y); if( intensity.data[index] >= lower ) { intensity.data[index] = MARK_TRAVERSED; output.unsafe_set(x,y,1); if( match ) { open.grow().set(x, y); } else { active.set(x,y); } return true; } } return false; } }
int y = (int)(pixel.y+0.5f); if( !imageDepth.isInBounds(x,y) ) continue;
int bx = active.x-dx, by = active.y-dy; if( intensity.isInBounds(fx,fy) && intensity.data[ indexForward ] >= lower ) { intensity.data[ indexForward ] = MARK_TRAVERSED; output.unsafe_set(fx, fy, 1); indexDir = prevIndexDir + dy*intensity.stride + dx; if( intensity.isInBounds(bx,by) && intensity.data[ indexBackward ] >= lower ) { intensity.data[ indexBackward ] = MARK_TRAVERSED; output.unsafe_set(bx,by,1);