get brightness value out of each pixel


    Feb 19 2013 | 10:51 pm
    Hey guys I'm not sure how to get the brightness value out of each pixel...
    I played about with video here, not so sure of the values:
    {
    	"boxes" : [ 		{
    			"box" : 			{
    				"maxclass" : "number",
    				"outlettype" : [ "int", "bang" ],
    				"fontsize" : 12.0,
    				"patching_rect" : [ 96.0, 334.0, 50.0, 20.0 ],
    				"numinlets" : 1,
    				"id" : "obj-14",
    				"fontname" : "Arial",
    				"parameter_enable" : 0,
    				"numoutlets" : 2
    			}
    
    		}
    , 		{
    			"box" : 			{
    				"maxclass" : "newobj",
    				"text" : "unpack 0 0 0",
    				"outlettype" : [ "int", "int", "int" ],
    				"fontsize" : 12.0,
    				"patching_rect" : [ 66.0, 307.0, 79.0, 20.0 ],
    				"numinlets" : 1,
    				"id" : "obj-10",
    				"fontname" : "Arial",
    				"numoutlets" : 3
    			}
    
    		}
    , 		{
    			"box" : 			{
    				"maxclass" : "newobj",
    				"text" : "jit.iter",
    				"outlettype" : [ "", "", "" ],
    				"fontsize" : 12.0,
    				"patching_rect" : [ 66.0, 257.0, 46.0, 20.0 ],
    				"numinlets" : 1,
    				"id" : "obj-6",
    				"fontname" : "Arial",
    				"numoutlets" : 3
    			}
    
    		}
    , 		{
    			"box" : 			{
    				"maxclass" : "message",
    				"text" : "open",
    				"outlettype" : [ "" ],
    				"fontsize" : 12.0,
    				"patching_rect" : [ 140.0, 188.0, 37.0, 18.0 ],
    				"numinlets" : 2,
    				"id" : "obj-5",
    				"fontname" : "Arial",
    				"numoutlets" : 1
    			}
    
    		}
    , 		{
    			"box" : 			{
    				"maxclass" : "message",
    				"text" : "close",
    				"outlettype" : [ "" ],
    				"fontsize" : 12.0,
    				"patching_rect" : [ 96.0, 187.0, 39.0, 18.0 ],
    				"numinlets" : 2,
    				"id" : "obj-3",
    				"fontname" : "Arial",
    				"numoutlets" : 1
    			}
    
    		}
    , 		{
    			"box" : 			{
    				"maxclass" : "toggle",
    				"outlettype" : [ "int" ],
    				"patching_rect" : [ 38.0, 133.0, 20.0, 20.0 ],
    				"numinlets" : 1,
    				"id" : "obj-92",
    				"parameter_enable" : 0,
    				"numoutlets" : 1
    			}
    
    		}
    , 		{
    			"box" : 			{
    				"maxclass" : "newobj",
    				"text" : "qmetro 30",
    				"outlettype" : [ "bang" ],
    				"fontsize" : 11.595187,
    				"patching_rect" : [ 38.0, 156.0, 63.0, 19.0 ],
    				"numinlets" : 2,
    				"id" : "obj-93",
    				"fontname" : "Arial",
    				"numoutlets" : 1
    			}
    
    		}
    , 		{
    			"box" : 			{
    				"maxclass" : "newobj",
    				"text" : "jit.qt.grab 320 240",
    				"outlettype" : [ "jit_matrix", "" ],
    				"fontsize" : 11.595187,
    				"patching_rect" : [ 39.0, 229.0, 103.0, 19.0 ],
    				"numinlets" : 1,
    				"id" : "obj-95",
    				"fontname" : "Arial",
    				"numoutlets" : 2
    			}
    
    		}
    , 		{
    			"box" : 			{
    				"maxclass" : "jit.pwindow",
    				"outlettype" : [ "", "" ],
    				"patching_rect" : [ 39.0, 415.0, 320.0, 240.0 ],
    				"background" : 1,
    				"numinlets" : 1,
    				"id" : "obj-96",
    				"numoutlets" : 2
    			}
    
    		}
     ],
    	"lines" : [ 		{
    			"patchline" : 			{
    				"source" : [ "obj-95", 0 ],
    				"destination" : [ "obj-96", 0 ],
    				"hidden" : 0,
    				"disabled" : 0
    			}
    
    		}
    , 		{
    			"patchline" : 			{
    				"source" : [ "obj-92", 0 ],
    				"destination" : [ "obj-93", 0 ],
    				"hidden" : 0,
    				"disabled" : 0
    			}
    
    		}
    , 		{
    			"patchline" : 			{
    				"source" : [ "obj-93", 0 ],
    				"destination" : [ "obj-95", 0 ],
    				"hidden" : 0,
    				"disabled" : 0
    			}
    
    		}
    , 		{
    			"patchline" : 			{
    				"source" : [ "obj-95", 0 ],
    				"destination" : [ "obj-6", 0 ],
    				"hidden" : 0,
    				"disabled" : 0
    			}
    
    		}
    , 		{
    			"patchline" : 			{
    				"source" : [ "obj-6", 0 ],
    				"destination" : [ "obj-10", 0 ],
    				"hidden" : 0,
    				"disabled" : 0
    			}
    
    		}
    , 		{
    			"patchline" : 			{
    				"source" : [ "obj-10", 1 ],
    				"destination" : [ "obj-14", 0 ],
    				"hidden" : 0,
    				"disabled" : 0
    			}
    
    		}
    , 		{
    			"patchline" : 			{
    				"source" : [ "obj-3", 0 ],
    				"destination" : [ "obj-95", 0 ],
    				"hidden" : 0,
    				"midpoints" : [ 105.5, 212.0, 48.5, 212.0 ],
    				"disabled" : 0
    			}
    
    		}
    , 		{
    			"patchline" : 			{
    				"source" : [ "obj-5", 0 ],
    				"destination" : [ "obj-95", 0 ],
    				"hidden" : 0,
    				"midpoints" : [ 149.5, 217.0, 48.5, 217.0 ],
    				"disabled" : 0
    			}
    
    		}
     ],
    	"appversion" : 	{
    		"major" : 6,
    		"minor" : 0,
    		"revision" : 8
    	}
    
    }
    but I want the value the brightness value of each pixel lets say of a static image, how do i do it? getcell and jit.matrix ? what's the best way to do it?
    can someone point it.

    • Feb 19 2013 | 11:39 pm
      the easiest way is to use a jit.rgb2luma object. That will convert each pixel's RGB value into a luma (brightness) value.