Extract stamps images from image

Hello KNIMErs.

I have a challenge and need some help.
For each image, extract all stamps images into individual images.
The problem is that all stamps are in different positions and sizes.

Any help or ideas are welcome.

Best regards
Hugo

What is the format of the file you’re trying to extract the images from? Can you share some sample data?

1 Like

Hi @rfeigel thank you for your help

I supplyed one 20251108_212217.jpg as example, but have many more to process.

From this

To these

I don’t know what is the best aproach.

Regards

Googles Gemini is VERY strong on OCR tasks. So it would be a great approach to extract the stamps with it.

As an example I just uploaded the first image to Gemini and asked for the stamps. Here’s the summary:

Gerne, hier ist die englische Übersetzung der Analyse:

:framed_picture: Extraction of the Stamps

This is a very detailed depiction! I would be happy to help you identify and extract the individual stamps and the included souvenir sheet.

These are stamps and a souvenir sheet (or mini-sheet) from Liberia commemorating the XX Summer Olympic Games in Munich, Germany, 1972. The depicted motifs show landmarks in Munich and Olympic scenes.


:magnifying_glass_tilted_left: Identification of the Individual Stamps and Sheet

Here are the individual pieces visible on the album page, along with their descriptions:

Stamp / Sheet Face Value Motif Special Feature / Note
Single Stamp 3 ¢ Hall of Honor (Ruhmeshalle at the Theresienwiese)
Single Stamp 5 ¢ View of Munich (View of Munich, possibly including the Frauenkirche)
Single Stamp 10 ¢ National Museum (Bavarian National Museum)
Single Stamp ? Max Joseph’s Square (Max-Joseph-Platz) Notable: The right part of the image appears to have missing foil or a printing flaw, affecting the shiny/metallic part of the original design.
Single Stamp 20 ¢ Propylaeum on King’s Square (Propyläen on Königsplatz)
Single Stamp 25 ¢ Liesel-Karlstadt Fountain
Souvenir Sheet (Mini-Sheet) 25 ¢ (Top) 30 ¢ (Bottom) Top: Munich Olympic Village (Olympic grounds and village) Bottom: Yachting Regatta (Sailing event, which took place in Kiel) The sheet consists of two separate stamps (25 ¢ and 30 ¢) within a common border and text (“Republic of Liberia”).

In Summary: The page contains six single stamps and one souvenir sheet comprising two separate stamps, resulting in a total of eight face values.


:police_car_light: Conspicuous Details

The stamp featuring the Max Joseph’s Square is particularly interesting, as a part of the original design (likely a metallic or shiny foil embossing) is either missing, damaged, or incompletely printed. This could be a flaw that increases the value for specialized collectors, or simply damage to the foil.

Would you like me to search for more details regarding a specific motif, the value, or the philatelic classification of this 1972 Liberia issue?

So you can use the Gemini API to send the images to it and let it extract the stamps. If you want to combine KNIME and Gemini the KNIME AI extension is the best way to start.

4 Likes

Hi @ActionAndi, and thank you.

Great. Can be a solution.

  1. Identify all stamps on each sheet with Gemini API, and obtain the Michel catalog # code for each stamp.
  2. Get all the other elements (including picture) from colnect stamps API.

I’ll try this and return.

Thanks all and best regards.

Hugo

2 Likes

@hmfa I tried an approach with the help of ChatGPT and Python:

The workflow first detects the color-saturated regions on a stamp album page to isolate each stamp + caption block and saves those as “outer” crops.
Then, for each crop, it analyzes the caption text below to estimate the correct horizontal boundaries and runs edge-based rectangle detection within that region to extract the precise inner stamp (image + perforation).
This two-stage, caption-guided method keeps each stamp tightly framed while avoiding overlaps with neighboring stamps.

The results of the ‘inner’ processings do look promising I would say. Considering the relatively poor scan. This also might serve as a future idea to separate shares in images. One idea could also be to let the images run again thru an additional process that would just try to get rid of the borders.

One advantage: this process is relatively fast.

Another idea is to use a local LLM like Mistral that has multimodal capacities. One could test if this is possible with the KNIME nodes or if a Python approach accessing Ollama might work.

5 Likes

Hi, @mlauber71
Thank you for your help. It’s a very good approach for ~99% of cases, very simple and quick. There are some exceptions when the stamp doesn’t have a frame. I’ve included two examples, but it’s a wonderful solution. Thank you for your time and help and I’m sorry for not attributing the solution to you, but I was going the longer route of @ActionAndi

Best regards

Hugo

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.