Help! Quadrat Sampling

I am a new user of ImageJ and I’m having trouble figuring out how to place a quadrat on a photo to sample hermit crab populations on the ocean floor. The pictures were taken on a GoPro camera, looking out at a sandy-bottom area instead of directly down at the area. Is there a way to overlay a quadrat so that it “goes into” the photo (2D?) if I have a point of reference inside the photo to set the scale.

If this is for display purposes you can create a non destructive overlay with ImageJ and then you can flatten the image to “burn” it into the image:

From a selection an overlay can be created with:

Image->Overlay->Add Selection

Or with a macro:

makeRectangle(5, 5, 50, 50);   //makeRectangle(x, y, width, height)
run("Add Selection...");

To create a new image with the Overlay use:

Image->Overlay->Flatten

You find more informations about overlays here:

https://imagej.nih.gov/ij/docs/guide/146-11.html

Hi @mjfahey19,
you’ll find below a small macro to generate a grid.
You can either fixe:

  • the block size
    or
  • row and column numbers

Cheers,
Romain

// MACRO : demo about how to : "Make make a grid from an existing ROI"

roiManager("Reset");// reset the ROI manager
run("Close All");   // close every image

// you can either 
// fix the size of each block 
squareBlockSize = 20;

// or fix the row and column numbers
columnNbr = 5	;
rowNbr 	= 5	;

// here you decide which strategy you prefer
blockSizeFixed = true ; // replace by false to use the fixed  row and column numbers

// let's take a random image
run("Fluorescent Cells (400K)");

// and we create a ROI on it
makeRectangle(20, 20, 200, 200);
Roi.setName( "Original ROI" );
//roiManager("Add");
Roi.getBounds(xInitROI, yInitROI, widthInitROI, heightInitROI);

if(blockSizeFixed){ // if the size of the block is fixed
	blockWidth = squareBlockSize;
	blockHeight = squareBlockSize;
					// we calculate column and row nbr
	columnNbr	= round (widthInitROI / blockWidth );
	rowNbr		= round (heightInitROI / blockHeight );
	
} else {			// otherwise if the column and row nbr are fixed
					// we calculate the size of the block
	blockWidth  =  round (widthInitROI / columnNbr );
	blockHeight =  round (heightInitROI / rowNbr );	
}

// Not mandatory, but to create sub-ROIs, and to name them after their position
columnDigit = lengthOf( d2s(columnNbr, 0) );
rowDigit = lengthOf( d2s(rowNbr, 0) );

// A loop that iterates through rows and column to make sub-ROIs
for(rowIndex = 0 ; rowIndex < rowNbr ; rowIndex++){
	for (columIndex = 0 ; columIndex < columnNbr ; columIndex++ ){
		makeRectangle( (xInitROI+columIndex*blockWidth), (yInitROI+rowIndex*blockHeight), blockWidth, blockHeight);
		Roi.setName( IJ.pad( (rowIndex+1), rowDigit)+"_"+IJ.pad( (columIndex+1),columnDigit ) );
		//roiManager("Add");     // add to ROImanager
		run("Add Selection..."); // add to overlay
	}
}

run("Select None");