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-visualization.md

View on GitHub
# Visualization Patterns for blockedImage

> **If the `matlab-display-image` skill is available, load it for full imageshow/viewer2d guidance.** This file covers blockedImage-specific visualization patterns only.

## Strategy: overview + detail for very large data
When data is too large to render at full resolution interactively, use a two-panel layout: a low-resolution overview for spatial orientation, and a high-resolution detail view for a cropped region of interest. This applies to both 2D (`viewer2d` + `imageshow`) and 3D (`viewer3d` + `volshow`). See "Overview + detail navigation" below for the 2D pattern, and `blocked-3d-volumes.md` "Overview + detail for large 3D volumes" for the 3D pattern.

## Basic display (R2024b+)
Use `imageshow` for display and exploration:
```matlab
imageshow(bim);
```
- Auto-selects resolution level based on zoom level and screen size
- Scroll to zoom, drag to pan
- Pixel info display in bottom-left corner (coordinates + color/intensity under cursor)
- Right-click context menu to hide pixel info


## World coordinates display
Parent `imageshow` to a `viewer2d` with `SpatialUnits` for labeled measurements:
```matlab
viewer = viewer2d(ScaleBar="on", SpatialUnits="mm", ScaleBarStyle="measure");
imageshow(bim, Parent=viewer);
```
Set `bim.WorldStart` and `bim.WorldEnd` to define the real-world coordinate mapping. Use `pixelSpacing * bim.Size(1,:)` to compute `WorldEnd` from known pixel size.

## Overlay display
Display a mask or label overlay on top of a blocked image:
```matlab
% Create mask at a coarse level (must fit in memory)
bmask = apply(bim, @(im) im2gray(im.Data) < 200, Level=2);

% Display with green overlay
imageshow(bim, OverlayData=bmask, OverlayColormap=[0 1 0]);
```
- `OverlayData` can be a single-level or multi-level blockedImage (must match `Size`, `BlockSize`, `NumLevels`, `WorldStart`, `WorldEnd` of the image)
- `OverlayAlpha` — uniform transparency (scalar)
- `OverlayAlphamap` + `OverlayDisplayRangeMode="data-range"` — per-class transparency (e.g., `[0.1 0.5]` for background vs foreground)

## Synchronized side-by-side comparison
Use `linkviewers` to sync zoom/pan across two displays:
```matlab
g = uigridlayout;
v1 = viewer2d(g); v1.Layout.Column = 1;
v2 = viewer2d(g); v2.Layout.Column = 2;
imageshow(bim, Parent=v1);
imageshow(bimProcessed, Parent=v2);
linkviewers([v1, v2]);
```

## Overview + detail navigation
Show a fixed coarse overview on the left with a rectangle ROI that controls a detail view on the right. Moving/resizing the ROI updates the detail view; zooming/panning the detail view updates the ROI.
```matlab
g = uigridlayout(uifigure, ColumnWidth={"1x","1x"}, RowHeight={"fit"});
vOverview = viewer2d(g, ScaleBar="off"); vOverview.Layout.Column = 1;
vDetail   = viewer2d(g, ScaleBar="off"); vDetail.Layout.Column = 2;

hOverview = imageshow(bim, Parent=vOverview);
hOverview.ResolutionLevel = bim.NumLevels;  % fix to coarsest
imageshow(bim, Parent=vDetail);              % auto level

% Draw rectangle ROI on overview
roi = uidraw(vOverview, "rectangle", Position=[x y w h], Color="r", Label="");
vOverview.Annotations = roi;

% Link: ROI <-> detail view via CameraViewport
vOverview.UserData.detail = vDetail;
vDetail.UserData.overview = vOverview;
addlistener(vDetail, "CameraMoved",    @(src,~) set(src.UserData.overview, Annotations=src.CameraViewport));
addlistener(vDetail, "CameraMoving",   @(src,~) set(src.UserData.overview, Annotations=src.CameraViewport));
addlistener(vOverview, "AnnotationMoved", @(src,~) set(src.UserData.detail, CameraViewport=src.Annotations));
```
Key properties: `viewer2d.CameraViewport` (get/set the visible region), `viewer2d.Annotations` (get/set ROI shapes), `imageshow.ResolutionLevel` (fix or let auto-manage).

## Annotations (R2026a+)
Draw annotations from the `viewer2d` toolbar or programmatically with `uidraw`:
```matlab
roi = uidraw(viewer, "freehand", Position=coords, Color="r", FaceAlpha=0.5, Label="tumor");
viewer.Annotations = roi;
```
Shapes: `"point"`, `"line"`, `"rectangle"`, `"circle"`, `"ellipse"`, `"polygon"`, `"polyline"`, `"freehand"`, `"angle"`. Pass a cell array of positions to create multiple ROIs at once.

With world coordinates and `SpatialUnits` set, annotation labels display real-world measurements. Use `Wait="none"` for non-blocking programmatic placement.

## Dynamic adapter property updates
When using a virtual composite adapter (e.g., channel mapping, colorization), updating adapter properties does not automatically refresh the display. Clear the internal cache and reassign to force a re-read:
```matlab
bimRGB.Adapter.RGBChannelMapping = [3 2 1];
bimRGB.BlockCache.reset();
hDisplay.CData = bimRGB;
```

## Fixing resolution level for overview panes
Pin an `imageshow` to a specific (coarse) resolution level for overview navigation:
```matlab
hOverview = imageshow(bim, Parent=vOverview);
hOverview.ResolutionLevel = bim.NumLevels;  % always show coarsest
```

## 3D volume visualization
For 3D blockedImage volumes, use `volshow` and `viewer3d` instead of `imageshow`/`viewer2d`. See `blocked-3d-volumes.md` for full `volshow` patterns (rendering styles, slice planes, overlays, side-by-side comparison with `linkviewers`).

----

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: 197kUpdated 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