ofPixels resize for ARToolkit markers

Hi,
I’m working on a project based on ARToolkit and I need to resize and print the markers provided with the library (here an example https://dl.dropboxusercontent.com/u/5049281/static/BchThin-0010.png). Each marker image files is stored in a really small file (8x8 pixels) and I need to resize it without lose resolution. If I try to do it with a common image viewer (like anteprima on a mac) white pixels and black pixels will blend together making the marker unusable.

Switching to OF, if I load the image using ofImage and I try to resize it with myofImage.resize will happen the same thing (image resized1).

This is the code I used:

  
  
ofImage marker;  
int newWidth = marker.getWidth * 100;  
int newHeight = marker.getHeight * 100;  
marker.loadImage("pathToImage/BchThin_0010.png");  
marker.resize(newWidth,newHeight);  
  

If I try with ofPixels, using this code

  
  
ofPixels pixels;  
ofImage markerLarge;  
pixels.setFromExternalPixels(marker.getPixels(), marker.getWidth(), marker.getHeight(), 3);  
pixels.resize(newWidth, newHeight);  
markerLarge.setFromPixels(pixels);  
  

I’ve better result (image resized2), black and white are not blended, but black border seem cut;

What should I try?
thanks in advance

Hello,
I read your question, did you resolve it?? i have the same problem…
tnx in advanced for help!

No, I didn’t resolve it. Now I’m not working anymore at the project, but if I will find a solution I will reply here. :slight_smile:

Bye

you can use:

  
  
img.getPixelsRef().resize(w,h)  
img.upadte()  
  

ofPixels uses nearest neighbour as default resizing algorithm so it won’t smooth when resizing as ofImage does

If I try to do it with this code this is the result (from 8x8 pixels image to 200x200). The image is not resized properly and the borders have strange colors.

![](http://forum.openframeworks.cc/uploads/default/3101/Schermata 2013-11-17 alle 13.00.44.png)