Skip to content

matlab/matlab-agentic-toolkit / skills-catalog/image-processing-and-computer-vision/matlab-process-images

matlab-process-images

Verified

Load this first for any MATLAB task involving images, photos, scans, frames, volumes, or visual data — reading, writing, filtering, enhancing, denoising, sharpening, deblurring, thresholding, segmenting, masking, detecting, counting objects, removing backgrounds, measuring, registering, stitching, aligning, cropping, resizing, or transforming. Covers image I/O (TIFF, PNG, JPEG, RAW, HDR), histograms, edge detection, color, morphology, deep learning for images, quality assessment, and 3-D volumes. Also for image problems (dark, noisy, blurry, low contrast, uneven lighting, hazy, color cast) or data exploration (folder of images). Includes medical imaging I/O (DICOM, NIfTI, NRRD, medicalVolume) and large/blocked images (blockedImage, whole-slide). Skip if the user just wants you to look at an image, with no MATLAB work. Not for Simulink video-block models, C/C++/CUDA code generation or GPU deployment of a network, or point clouds. Hyperspectral and visual inspection have sibling skills.

FileKindSize
SKILL.mdskill md15.8 KB
manifest.yamlconfig811 B
references/3d-volume-processing.mdmarkdown20.2 KB
references/analysis-measurement.mdmarkdown18.5 KB
references/app-building.mdmarkdown16.9 KB
references/blocked-3d-volumes.mdmarkdown9.9 KB
references/blocked-data-discovery.mdmarkdown22.1 KB
references/blocked-geospatial.mdmarkdown3.2 KB
references/blocked-specialized-workflows.mdmarkdown4.3 KB
references/blocked-training-and-labeling.mdmarkdown7.0 KB
references/blocked-visualization.mdmarkdown5.1 KB
references/blocked-whole-slide-images.mdmarkdown3.1 KB
references/color-processing.mdmarkdown9.0 KB
references/deblurring.mdmarkdown8.1 KB
references/deep-learning-imaging.mdmarkdown14.8 KB
references/dicom-anonymization.mdmarkdown3.3 KB
references/dicom-rt-workflows.mdmarkdown7.4 KB
references/filtering.mdmarkdown21.8 KB
references/geometric-transforms.mdmarkdown14.3 KB
references/image-io.mdmarkdown15.5 KB
references/image-understanding.mdmarkdown20.0 KB
references/ipt-reading-writing.mdmarkdown4.8 KB
references/large-image-processing.mdmarkdown12.3 KB
references/medical-data-io.mdmarkdown8.3 KB
references/mit-medical-volume.mdmarkdown8.2 KB
references/mit-spatial-referencing.mdmarkdown5.9 KB
references/morphological-ops.mdmarkdown18.0 KB
references/preprocessing.mdmarkdown14.4 KB
references/quality-assessment.mdmarkdown13.5 KB
references/registration.mdmarkdown24.7 KB
references/segmentation-automated.mdmarkdown9.7 KB
references/segmentation-interactive.mdmarkdown15.3 KB
references/texture-transforms.mdmarkdown10.4 KB
references/video-io.mdmarkdown3.4 KB

references/blocked-geospatial.md

View on GitHub
# Geospatial Blocked Images

blockedImage works with GeoTIFF and other geospatial formats. For general coordinate system and spatial referencing concepts (subscripts, block subscripts, world coordinates, multiresolution alignment), see `blocked-specialized-workflows.md`.

## Setup
```matlab
bim = blockedImage("large_geotiff.tif");
geoinfo = georasterinfo(bim.Source);
bimref = geoinfo.RasterReference;
```
`blockedImage` reads GeoTIFF as a normal TIFF. Use `georasterinfo` separately to obtain the `MapCellsReference` or `GeographicCellsReference` object for coordinate conversions.

## Reading a region by projected coordinates
Convert map/geographic coordinates to pixel coordinates, then use `getRegion`:
```matlab
projylims = [2954280, 2954623];
projxlims = [773345, 773879];
[pixelStartYX, pixelEndYX] = worldWindowToDiscreteWindow(bimref, projylims, projxlims);
region = getRegion(bim, [pixelStartYX 1], [pixelEndYX 3]);
```

## Getting georef for a block
When processing blocks in `apply()`, compute the per-block map/geo reference from block metadata:
```matlab
[block, blockInfo] = getBlock(bim, [7 3 1]);
blockRef = cropMapGeoRef(bimref, blockInfo.Start, blockInfo.End);
mapshow(block, blockRef)
```
Inside an `apply` function, use `bs.Start` and `bs.End` the same way.

## Crop and mask with shapefiles
1. Load the shapefile: `shapes = shaperead('hydro_area.shp');`
2. Get bounding box in world coordinates from `shapes(k).BoundingBox`
3. Convert to pixel coordinates with `worldWindowToDiscreteWindow`
4. **Zero-copy crop:** `bimcrop = crop(bim, pixelStart, pixelEnd);` — instant, no data copied
5. Compute cropped reference: `cropRef = cropMapGeoRef(bimref, pixelStart, pixelEnd);`

### Vector to raster mask
Convert shapefile polygon vertices to pixel coordinates, then create a blockedImage mask:
```matlab
[polyy, polyx] = worldToDiscrete(bimref, shape.X, shape.Y);
bmask = polyToBlockedImage({[polyx' polyy']}, true, bimcrop.Size(1:2), ...
    WorldStart=bimcrop.WorldStart, WorldEnd=bimcrop.WorldEnd);
```
Use the mask with `selectBlockLocations` and `ExtraImages` to process only the masked region with pixel-level masking. See `blocked-specialized-workflows.md` for the full `selectBlockLocations` + `ExtraImages` patterns (including `InclusionThreshold` tuning and resolution mismatch handling).
```matlab
bls = selectBlockLocations(bimcrop, BlockSize=[512 512], ...
    Mask=bmask, InclusionThreshold=0);
bResult = apply(bimcrop, @maskAndProcess, ExtraImages=bmask, BlockLocationSet=bls);
```

## Export with geospatial metadata
When writing processed output, preserve GeoTIFF tags. Note that the TIFF adapter does not automatically carry GeoTIFF tags — these must be inserted separately after writing (e.g., with `geotiffwrite` or by copying tags from the source).

## Multi-resolution pyramids for GeoTIFF
Create a pyramid for efficient visualization:
```matlab
bim = makeMultiLevel2D(bim, Scales=[1 1/8], Adapter=images.blocked.TIFF);
```
For parallel processing, use H5Blocks first (supports parallel writes), then convert to TIFF:
```matlab
bResult = apply(bim, @fcn, UseParallel=true, OutputLocation=outDir, Adapter=images.blocked.H5Blocks);
write(bResult, "output.tif", Adapter=images.blocked.TIFF, BlockSize=[512 512]);
```

----

Copyright 2026 The MathWorks, Inc.
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall