# Encoding RGB image

**URL:** <https://discourse.numenta.org/t/encoding-rgb-image/3463>\
**Category:** Numenta Theory\
**Created:** [February 14, 2018, 9:12am UTC](https://discourse.numenta.org/t/encoding-rgb-image/3463 "2018-02-14T09:12:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tMan26](https://avatars.discourse-cdn.com/v4/letter/t/d9b06d/32.png) [@tMan26](https://discourse.numenta.org/u/tMan26)\
**Post date:** [February 14, 2018, 9:12am UTC](https://discourse.numenta.org/t/encoding-rgb-image/3463/1 "2018-02-14T09:12:45Z")

</div>

Hello everyone,

i just started to learning about HTMs and have few questions for which I cant find answers on Google or this forums.

Does input to HTM must be sparse (can i just convert rgb pixels into bit sequence? If yes, is there any better way to encode image than encoding RGB pixels into three integers using integer sparse coder?

---

<div class="post-metadata">

**Author:** ![rhyolight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/rhyolight/32/3922_2.png) [@rhyolight](https://discourse.numenta.org/u/rhyolight)\
**Post date:** [February 14, 2018, 4:30pm UTC](https://discourse.numenta.org/t/encoding-rgb-image/3463/2 "2018-02-14T16:30:53Z")

</div>

It is not as simple as it seems.

Definitely read through this thread, which exposes a lot of the challenges involved in this problem:

> [@Encoding vision for HTM](https://discourse.numenta.org/t/encoding-vision-for-htm/2780):
>
> @sunguralikaan I hope you don’t mind I pulled this into a new topic since it seems like it could spawn a whole discussion of its own. I’ve tried a few things for encoding visual input to HTM; here are my thoughts. (1 - color discretization) The simplest starting point that I’ve used for a visual encoder is to bin each pixel into one of 8 categories based on the RGB intensity: low-red/low-green/low-blue, low-red/low-green/high-blue, low-red/high-green/low-blue, low-red/high-green/high-blue, and…

Another relevant thread:

> [@SDR questions for image encoding (newbie)](https://discourse.numenta.org/t/sdr-questions-for-image-encoding-newbie/1674):
>
> Hi everyone, I have been a lurker for a while now and reading many of the questions, but now signing up to post my question as I have been working towards my own implementation of Sparse Vectors.I am trying to encode images to enable an SDR to recognize , say cats and dogs - a canonical problem in machine vision. I followed the guidelines in the [encoding data for htm] ([Encoding Data for HTM Systems](https://discourse.numenta.org/t/encoding-data-for-htm-systems/400)) and encoding the pixel levels in each of the Blue,Green,Red Channels with w=50 and n=1000. He…
