openframeworks / openframeworks/openFrameworks

Loading alternative additional pixel types (e.g. signed short) via ofPixels

Open
#3,249 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core feature prelim-analysis section-2D
Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

Hi all, I'm in the process of loading GeoTIFF images (terrain data from NASA, etc) and found that the images won't load in their native format using the standard ofPixels loading methods. After digging around a little bit, it turns out that it is because the image format (TIFF) uses 16bit signed shorts. I tried to then load it by passing ofPixels_<short> (as opposed to using ofShortPixels (aka ofPixels_<unsigned short>), but putBmpIntoPixels() method doesn't support signed short pixels and fails.

Currently I'm able to successfully load the GeoTIFF images by reimplementing the FreeImage code, but I'm wondering if there would be a way to make putBmpIntoPixels() more flexible to allow data types other than the standard float, unsigned char, and unsigned short when using ofPixels_<>.

I realize there are strategic and style reasons for pre-defining the ofPixel_ types, but just curious. @arturoc do you have any thoughts on this?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the standard ofPixels loading path into putBmpIntoPixels() and compare it with the reimplemented FreeImage code described for GeoTIFF images. Define what support for signed-short pixels should cover, then verify that signed-short GeoTIFF data loads through the normal ofPixels methods without breaking float, unsigned-char, or unsigned-short pixels.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.