Translate
Moves the image horizontally and vertically. The image keeps its size: the uncovered area turns black, and what goes past the edge is cut.
- translate x
- Pixels to the right (negative: to the left).
- translate y
- Pixels down (negative: up).
OpenCV Editor builds image and video processing pipelines without writing code. You pick an image (or a video, or your camera), then add steps: each one does one thing, like cropping, blurring or detecting faces. The steps run from top to bottom, and the preview shows the result right away. When the result is right, you can download the image or video, or export the pipeline as Python code that does the same thing with OpenCV.
Workspaces are saved automatically as you work. Commits are snapshots you make yourself, to go back to later.
The screen has three parts:
At the top you also find the workspace's title, the undo and redo buttons, the branch chip (see Commits, history and branches), the export menu, and a link to report a bug or request a feature.
Every workspace starts from one source. The buttons next to the preview set it:
| Button | What it does |
|---|---|
| Upload custom image | Uses an image file from your device. |
| Upload video | Uses a video file. The steps run on each frame; see Working with video. |
| Use camera | Uses your device's camera, live. The browser asks for permission first. |
| Create canvas | Opens a drawing canvas: choose a size and a background, then draw shapes, lines or free hand. The drawing is kept, so you can open it again and change it. |
| Paste from clipboard | Uses the image you copied (also Ctrl+V when no step is selected). |
| Remove the image | Removes the source. The steps stay. |
| Image info | Shows the image's size, channels and format. |
| Optimize the video | Converts a video to a format the editor reads faster, which makes the preview smoother. |
Inside the steps, the source is always available as #source, whatever the steps above did to the current image.
Every change can be undone with Ctrl+Z and redone with Ctrl+Shift+Z.
Clicking a step opens its details: a panel with the step's settings (its params). The preview updates as soon as you change a value. The ? button at the top of the panel opens this guide at the step's section, and the × button closes the panel.
#size * 2. Many have a minimum and a maximum; a value out of range is refused with a message.#source or #mask.Every step except Variable also has a Flow section at the top, folded to one line (Flow: current image → current image) while it holds the defaults. It decides which image the step works on and where its result goes: see Branches and named images.
A Variable step gives a value a name. The steps below it can use the value by writing #name in a field of the same type: while you type #, the field suggests the variables available there. Changing the Variable's value updates every field that uses it, which makes it easy to tune several steps at once (for example, the same size for an Erode and a Dilate).
_, then only letters, digits and _, 64 characters at most. source is reserved.A number field can hold a calculation instead of a plain number:
| What | Examples |
|---|---|
Arithmetic: + - * /, // (whole division), % (remainder), ^ (power), parentheses | #size * 2 + 1, (#w - #margin) / 2, 2 ^ #level |
Functions: min, max, abs, clamp, round, floor, ceil, sqrt, exp, log, trigonometry and more (the field suggests them as you type) | max(3, #size), round(#angle / 15) * 15 |
The constant pi | #r * 2 * pi |
Conditions: comparisons (< <= > >= == !=), &&, ||, !, and condition ? then : else | #big ? 15 : 3 |
| Lookup lists: pick the item at an index | [3, 5, 9][#level] |
An expression is 256 characters at most. In a video, the steps can also use the time and the frame number, so a value can change over the video.
Some steps also give values, not only an image: Measure Image gives the image's size and brightness, Detect Objects the objects it found and their count, Read Codes what the codes say, and so on.
#name, like a variable: for example a DrawText that writes #count. Renaming it updates the steps that use it.→ #faces · #count with a dotted border: they are values, not an image.A model is a trained neural network. The model steps (Classify, Detect Objects, Segment, Estimate Depth and Apply Model) run one of the models of your library on the image.
labels.txt (Ultralytics, PyTorch, Teachable Machine, Roboflow…).Most workspaces are a straight line: every step works on the image the step above produced. The Flow section of a step changes that:
| Setting | Choices | Default |
|---|---|---|
| Input | The image the step works on: the current image, #source, or a name given by a step above. | Current image |
| Output | Replaces the current image, or Detached: the current image goes on unchanged. | Replaces |
| Name | Optional: the steps below can use this step's output as #name. | empty |
#mask → when the step reads #mask, → #mask when it gives that name. Detached steps are indented on a colored rail, one color per name.Colors only where the photo is bright, gray elsewhere:
mask.#mask, Output Detached, Name mask.#mask, Output Detached, Name mask.#mask and outside to grayscale.The first three steps never change the current image: they only build #mask. Apply Mask works on the untouched photo. Use the eye button of a detached step to see the mask it produced.
Before and after: add a Stack step at the end with new image set to #source to see the original next to the result.
The Nodes side of the List / Nodes switch (Alt+N) shows the same steps as a graph. Both views edit the same pipeline: a change in one shows in the other.
The preview shows the result of all the enabled steps, or the output of the step whose eye button is on. When a step fails (for example, an expression gives a value out of range), the step shows the error and the preview stops at the step above it.
The performance panel in the bottom bar lists each step with its time, and the render time of the whole pipeline. Use it to find the slow steps. Detached steps that nothing uses show as not used, skipped.
Slow steps (AI tools, Optical Flow, large blurs) run faster on a smaller image: add a Resize step before them.
With a video as the source, every step runs on each frame. The timeline under the preview has a slider, and the previous frame, play/pause and next frame buttons (,, K and .).
The export menu has three parts:
The name of the downloaded files follows the format set in your profile, which can use {workspace_name}, {year}, {month} and other fields.
Each workspace has its own version history, like a small Git:
-, _, . and /; tick Switch to it to move there), Rename and Delete. Deleting a branch also deletes its commits that aren't on another branch.These branches are versions of the whole workspace. They are not the same thing as the image branches inside a pipeline.
The defaults are below. Change them in your profile, or for one workspace in the Keyboard reference dialog of the bottom bar.
| Action | Default |
|---|---|
| Select all steps | Ctrl+A |
| Copy / paste steps | Ctrl+C / Ctrl+V |
| Delete the selected steps | Delete |
| Undo / redo | Ctrl+Z / Ctrl+Shift+Z |
| Commit | Ctrl+S |
| Previous / next frame | , / . |
| Play / pause | K |
| List / node view | Alt+N |
| Fit the nodes on screen | Home |
| Tidy the nodes | Shift+T |
| Rename a node | F2 |
Every step, grouped as in the categories bar. Coordinates are in pixels from the top-left corner of the image, unless a field offers %. Colors are picked with a color picker.
Moves the image horizontally and vertically. The image keeps its size: the uncovered area turns black, and what goes past the edge is cut.
Rotates the image around its center. The image keeps its size, so the corners are cut and the uncovered areas turn black.
Mirrors the image.
Cuts the borders of the image.
Use % to keep the same framing when the source changes size.
Changes the size of the image.
INTER_LINEAR (default, good all-round), INTER_AREA (best to shrink), INTER_CUBIC / INTER_LANCZOS4 (sharper to enlarge), INTER_NEAREST (no smoothing, pixel-art look).Shrinking the image first makes every slow step after it faster.
Removes the colors: each pixel becomes a shade of gray of the same brightness. No settings.
Turns each channel into pure black or white: 255 where the value is above the threshold, 0 elsewhere. On a color image this gives up to 8 pure colors; add Grayscale first for a black and white result.
Makes a negative: black becomes white and every color becomes its opposite. No settings.
Keeps one color channel and shows it as a gray image: bright where the image has a lot of that color.
Finds the edges of the image (Canny edge detection): white lines where the brightness changes sharply, black elsewhere. No settings.
A Blur before it removes the edges of noise and fine textures.
Draws in green the outer contours of the bright areas of the image. No settings.
Use Threshold before it to decide what counts as bright.
Softens the image.
Smooths flat areas while keeping the edges sharp, for a "beauty filter" or cartoon look. It is slower than Blur.
Shrinks the bright areas and grows the dark ones. On a black and white mask it removes small white specks and thin lines.
Erode then Dilate with the same settings removes specks and keeps the size of the big shapes.
Grows the bright areas and shrinks the dark ones. On a mask it fills small holes and joins close shapes. Same settings as Erode.
The drawing steps share these advanced settings: line type (line_8 default, line_4, or line_aa for smooth, anti-aliased edges) and shift (0 to 16, fractional bits of the coordinates; leave 0).
Draws a circle.
Draws an ellipse, or an arc of one.
Draws a straight line from point A to point B.
Draws a rectangle from one corner (A) to the opposite one (B).
Writes a line of text on the image.
The text can be a variable, like #title.
Draws the boxes that steps above found, with their labels and scores: the detections of Detect Objects, the faces of HaarCascade, the texts of OCR, contours, codes... Detect with the drawing off, work on the clean image, and draw at the end.
#detections, #faces or #texts (#detections[0] draws only the first one).Replaces the image with its histogram: one curve per channel (blue, green, red) showing how many pixels have each brightness from 0 (left) to 255 (right). A curve piled on the left means a dark image; on the right, a bright one. No settings.
Make it a detached step with a name to look at the histogram (eye button) without losing the image.
Measures the image and gives the values as outputs to the steps below. The image goes on unchanged.
Outputs: width and height (pixels), mean color, brightness (mean gray, 0 to 255), contrast (standard deviation of the gray), lit (share of the image above "lit above", 0 to 1), darkest and brightest gray values.
Name brightness and use it in a Threshold below (#brightness) to adapt the threshold to each image.
Detects objects with a pre-trained Haar cascade and outlines them.
It works best on front-facing, well-lit subjects. Resize large images first: it is faster and often finds the same things.
Finds English text in the image and draws a box around each word or line.
Finds the QR codes and barcodes (EAN-8, EAN-13, UPC-A, UPC-E, Code 128…) in the image, outlines them and writes what they say. The exported script also prints it.
Outputs: codes (each code's box, 4 corners, text and kind), texts (what each code says) and count.
These steps run a model of your library: pick it in the model field. They are slower than the other steps; a Resize before them helps on big images.
Says what the image shows with a classification model, and writes it in a corner ("cat 92%").
Outputs: label (the most likely class), score (its confidence, 0 to 1) and top 5 (the 5 most likely classes with their scores).
Finds the objects in the image with a detection model, and draws a box with its label around each one ("person 87%").
Outputs: detections (each object's box, label and confidence, most certain first), count and labels.
Finds the class of every pixel with a segmentation model, and shows each class in its color, or a mask of the classes you pick.
Outputs: classes (each class found, largest first, with its share of the image and its box).
To cut out a person: Segment showing a mask of person, detached as mask, then Apply Mask with #mask.
Estimates how far every pixel is with a depth model, and shows it in gray or with a color map.
Outputs: min, max and mean depth, in the model's units.
Turns the image into another one with an image-to-image model: super-resolution, denoising, style transfer…
These steps take a second image: upload a file, draw a canvas, or type a name like #source or #mask.
Puts a second image next to the current one, making a bigger image.
With #source as the new image you get a before/after comparison.
Mixes a second image over the current one with a given transparency.
Keeps the current image where the mask is white, and changes the rest.
#mask made by steps above).See the color splash example.
These steps are temporal: they use the frames before the current one, so they need a video or camera source. Their result is exact in a rendered video; during playback, skipped frames can change it a little.
Compares each frame with the previous one, to show what changed.
Learns the still background of the video and separates the moving foreground from it.
Draws a box around each moving object.
Shows the direction and speed of the motion between frames. It is slow: a Resize before it helps a lot.
Follows one object through the video, starting from a box you draw on the first frame.
Colors the areas where there is a lot of motion over time, like a heat map over the video.
Merges the frames over time, like a long-exposure photo.
Writes the time or the frame number on each frame.
Gives a value a name. The steps below can use it by writing #name in a field of the same type. Declaring the same name again changes its value from there on. The image is left as it is. See Variables and expressions.
my_variable. The step takes the variable's name in the list.