tags:

views:

35

answers:

1

So I am using one third party library which is not very well documented. It has a method which takes a picture with camera and this is what it returns:

'E{\x7fM{\x7f;\x89\x89:\x89\x89=\x81\x87<\x81\x87O\x90\x7fJ\x90\x7fB\x87\x80I\x87\x80<{\x81={\x81A\x81\x82A\x81\x82E\x81\x81:\x81\x818\x80\x81?\x80\x81?\x8c\x85C\x8c\x85Dw\x84Kw\x84K\x81}H\x81}S\x82|R\x82|N\x88xS\x88xP\x87|P\x87|H\x83}H\x83}J\x83|F\x83|S{\x80P{\x80G~zH~zDx\x7fDx\x7fI\x7f\x80M\x7f\x80I\x82yK\x82yH\x83\x80H\x83\x80K\x84\x80L\x84\x80K\x82|H\x82|G\x83\x83G\x83\x83M\x81\x80M\x81\x80K\x83~F\x83~H\x81~L\x81~N\x85|J\x85|B\x84\x82I\x84\x82K\x84\x7fJ\x84\x7fG\x83\x80F\x83\x80B~\x81G~\x81E}~G}~D}\x81B}\x81I|\x84I|\x84I\x82\x7fG\x82\x7fG\x80~E\x80~Iy\x81Jy\x81H|\x82M|\x82L\x81\x82I\x81\x82Gx\x82Hx\x82Ez\x7fGz\x7fL|\x81N|\x81G\x82\x80K\x82\x80L\x81}P\x81}J\x82\x7fH\x82\x7fCz|Dz|K}\x7fH}\x7fDs|Es|L\x83\x81I\x83\x81HxzHxzJ{\x83F{\x83G\x84\x81F\x84\x81I\x88\x85G\x88\x85Cu\x83@u\x83H}\x83D}\x83<u\x80;u\x80C\x88{C\x88{A\x7f\x82E\x7f\x82D\x84\x81C\x84\x81A}\x87A}\x87>|\x7fA|\x7fA}\x82;}\x82D\x83\x80?\x83\x80@\x80\x7fB\x80\x7fB\x80\x85A\x80\x85@u\x88>u\x888~\x848~\x84?w|=w|9|\x7f9|\x7f:\x84\x81;\x84\x81:~\x83;~\x836u\x87>u\x879{\x8d:{\x8d;\x7f\x86;\x7f\x86;y\x834y\x836\x82\x8c;\x82\x8c<y\x8b5y\x8bI~~M~~>\x88\x84:\x88\x84A\x81\x889\x81\x88B~\x81E~\x81A{\x81@{\x81O\x80\x83S\x80\x83\\\x85xf\x85xQ\x90\x80L\x90\x80G\x81\x7fK\x81\x7f@y\x83Dy\x83E~\x88E~\x88F\x81\x82M\x81\x82P\x82\x80O\x82\x80S\x85\x7fT\x85\x7fT\x83~U\x83~T\x88\x7fR\x88\x7fPz\x7fTz\x7fQ\x7f}P\x7f}Q}\x81U}\x81R\x7f\x7fO\x7f\x7fP\x83\x83N\x83\x83M\x85\x80R\x85\x80L\x87\x82O\x87\x82N\x82{N\x82{V|\x84P|\x84Rz\x83Qz\x83M\x89\x84R\x89\x84P\x8c\x85N\x8c\x85L\x80\x81I\x80\x81M|~N|~L}\x81J}\x81S\x82\x7fL\x82\x7fM}\x84I}\x84K~\x80L~\x80Lz\x80Iz\x80Hy\x80Ly\x80K~\x7fJ~\x7fJx\x82Ox\x82J\x7f\x81M\x7f\x81I\x80~J\x80~Q\x81\x82O\x81\x82M\x84\x7fH\x84\x7fO~\x80R~\x80I\x80\x84J\x80\x84J\x7f\x82L\x7f\x82N\x85\x85U\x85\x85R\x83\x87O\x83\x87U\x82\x80P\x82\x80N|\x85K|\x85O}~O}~J\x7f\x81K\x7f\x81M}\x86N}\x86I|\x82I|\x82Ix\x84Gx\x84My\x88Jy\x88J{\x7fH{\x7fF}{F}{G\x7f\x82K\x7f\x82E}\x7fE}\x7fBz\x80Dz\x80I}\x80J}\x80Dw\x81Dw\x81G\x82\x84H\x82\x84Fz\x85Cz\x85>\x85\x86;\x85\x86H\x8a\x84J\x8a\x84Cx\x80Cx\x80B\x80\x85B\x80\x85@|\x83B|\x83?{\x81@{\x81H{\x84@{\x84?y\x84Ay\x84A\x84\x85=\x84\x85;}\x81=}\x81=\x84\x86@\x84\x86:}\x85;}\x85=}\x83=}\x838\x81\x86=\x81\x86:\x81\x82>\x81\x82=w\x83?w\x83Ot\x81St\x81P\x86\x80L\x86\x80B\x83\x7f?\x83\x7f=\x82\x82>\x82\x82N{\x86H{\x86A\x82\x85K\x82\x85B\x85\x7fB\x85\x7fB\x8b\x85A\x8b\x85B\x83\x85@\x83\x85;\x86\x89?\x86\x89>\x86\x84A\x86\x848v\x81?v\x81I\x81\x81M\x81\x81R\x87\x7fU\x87\x7fT\x88~U\x88~R\x83~S\x83~N{yO{yR\x86\x80P\x86\x80T\x87\x7fQ\x87\x7fQ\x89\x81Q\x89\x81R\x88\x85S\x88\x85O\x80\x80N\x80\x80J\x83\x7fJ\x83\x7fN\x86\x7fM\x86\x7fL\x83\x88J\x83\x88M\x81\x82L\x81\x82O\x84\x82R\x84\x82R{\x80O{\x80K~}O~}R\x7f\x83N\x7f\x83N\x81\x86N\x81\x86Ny\x7fMy\x7fN\x84\x82N\x84\x82Ly\x82Ry\x82O\x81\x82M\x81\x82K|\x83Q|\x83O\x81\x82M\x81\x82J|\x80N|\x80I}\x84D}\x84K\x8a\x83M\x8a\x83M\x85}P\x85}R\x85\x83N\x85\x83Kz|Hz|H~}H~}Nm~Rm~N\x83~I\x83~O\x81\x80O\x81\x80J\x7f\x80K\x7f\x80J\x83\x80K\x83\x80Ix\x84Kx\x84L\x81\x84L\x81\x84J}\x83J}\x83K{\x7fK{\x7fGz}Cz}Ex\x83Hx\x83Jz{Jz{M\x7f\x82N\x7f\x82K}\x83F}\x83Ey\x7fEy\x7fGs\x7fHs\x7fG}\x83F}\x83Fv\x80Ev\x80Fw\x85Gw\x85G\x83\x84J\x83\x84B|\x85D|\x85@\x80\x80@\x80\x80D\x80\x82C\x80\x82B\x84\x86C\x84\x86A\x80\x81@\x80\x81Cu\x87Bu\x87I{\x83C{\x83C\x82\x82A\x82\x82@|\x85<|\x85@{\x88@{\x88D\x81\x89A\x81\x89;z\x857z\x85?\x7f\x84>\x7f\x84@\x81\x80A\x81\x80<\x83\x86;\x83\x86=}\x83:}\x83F\x7f|L\x7f|J\x8d\x85O\x8d\x85F\x8d\x85D\x8d\x85;}\x84B}\x84A\x81~D\x81~>\x80\x85A\x80\x85B{|={|?\x82\x82@\x82\x82;\x81\x827\x81\x82=w\x85=w\x85Gw\x82Iw\x82I}\x83K}\x83K\x8e\x80I\x8e\x80Q\x8d\x7fS\x8d\x7fR\x87\x7fU\x87\x7fQ\x88\x81Q\x88\x81N\x84\x83Q\x84\x83N\x85\x80O\x85\x80M\x88\x82P\x88\x82U\x81\x80P\x81\x80Tz\x7fQz\x7fOy\x7fOy\x7fN\x80\x82N\x80\x82Q\x85\x81R\x85\x81N\x87~L\x87~K\x87\x80M\x87\x80P\x8b\x85L\x8b\x85Q\x7f\x7fN\x7f\x7fQ\x7f\x81M\x7f\x81O\x84\x84Q\x84\x84Q\x80\x82Q\x80\x82I\x7f\x84J\x7f\x84Hn\x80On\x80I\x87\x87I\x87\x87Q\x7f\x80M\x7f\x80N\x83~L\x83~O\x81\x81O\x81\x81N\x7f\x80I\x7f\x80K\x82\x80N\x82\x80O\x80\x84Q\x80\x84O~\x83K~\x83Kt\x84Ot\x84P~\x85M~\x85L\x7f\x82K\x7f\x82Pz\x82Pz\x82J{\x81E{\x81L|\x81M|\x81J\x81\x81J\x81\x81K|\x83M|\x83K\x82\x80J\x82\x80I|\x82H|\x82P~\x89O~\x89Hx|Kx|Lw\x83Fw\x83N~\x87R~\x87P\x84\x80M\x84\x80>v|?v|E~\x81D~\x81Gx\x80Kx\x80I{\x7fD{\x7fB}\x7fD}\x7fG~\x84H~\x84J\x85\x80I\x85\x80H\x82\x80F\x82\x80=}\x80?}\x80D\x81\x82F\x81\x82C\x81\x84F\x81\x84Dt\x80Bt\x80B\x80\x81C\x80\x81A}\x82=}\x82C{\x86@{\x86Bv\x84Gv\x84?\x80\x7f=\x80\x7f?\x81\x89A\x81\x895q\x855q\x85@x\x82Ex\x82>|\x7f@|\x7f:~\x82>~\x82@\x84\x86@\x84\x867\x7f\x837\x7f\x83O~}T~}P\x8a\x83R\x8a\x83R\x8f\x7fL\x8f\x7f6x\x817x\x81?\x89\x83@\x89\x83H\x80\x80G\x80\x80I\x81\x83J\x81\x83H\x85\x85J\x85\x85J\x85\x82F\x85\x82M~\x80L~\x80Os\x80Ts\x80S~\x80R~\x80K\x86\x80N\x86\x80L\x8d\x81M\x8d\x81M\x87\x7fP\x87\x7fS\x84\x82Q\x84\x82M\x81{J\x81{S\x84}T\x84}T\x88\x82S\x88\x82U~\x7fT~\x7fO\x80}P\x80}Q\x85~Q\x85~P\x88\x82N\x88\x82M}\x80J}\x80M\x80\x81J\x80\x81I\x80\x82O\x80\x82S\x86\x83O\x86\x83T\x80\x7fR\x80\x7fL\x82\x7fK\x82\x7fT\x85\x80N\x85\x80L\x7f\x81O\x7f\x81P\x88\x80M\x88\x80Mw\x85Pw\x85O\x86\x87J\x86\x87Ov\x81Nv\x81M\x80\x84L\x80\x84Ox\x81Mx\x81M}\x80O}\x80P{\x83M{\x83M\x80\x82K\x80\x82H~\x80L~\x80Nz\x83Oz\x83M\x82}K\x82}O~\x83R~\x83R|\x85Q|\x85Nz\x7fKz\x7fQx~Rx~L}\x85K}\x85O\x82\x81N\x82\x81Q}\x81Q}\x81L~{M~{P\x7f~L\x7f~I\x80\x82H\x80\x82J\x7f\x83N\x7f\x83F}\x89J}\x89J\x7f\x83I\x7f\x83J\x81\x86I\x81\x86Et\x86Gt\x86K\x7f\x83J\x7f\x83I\x82\x84G\x82\x84Gz\x84Dz\x84Ky\x80Ey\x80G\x80\x80F\x80\x80G\x82\x85E\x82\x85>}\x81B}\x81Cv\x81Fv\x81=\x80\x84?\x80\x84C\x81\x81A\x81\x81C\x80\x82C\x80\x82@r\x82<r\x82>\x82\x83@\x82\x83C{\x82@{\x828w\x7f9w\x7f>x\x87<x\x87<|\x81>|\x81A{\x86@{\x86D\x80\x7fB\x80\x7f<v\x7f<v\x7f=\x83\x82>\x83\x82>}\x83<}\x83N}\x82R}\x82N\x8e\x81N\x8e\x81O\x8b|O\x8b|K\x87\x83K\x87\x83L\x82\x84M\x82\x84Q\x8d}R\x8d}N\x85}O\x85}M\x90{O\x90{U\x8d\x81Q\x8d\x81P\x89\x80O\x89\x80L\x7f~N\x7f~R\x88\x80S\x88\x80U\x8f\x84S\x8f\x84L\x81\x7fM\x81\x7fR\x82~S\x82~T\x84\x83V\x84\x83T\x83}R\x83}O\x7fzL\x7fzK\x86\x80P\x86\x80N\x7f\x83O\x7f\x83Q}\x81P}\x81S{}O{}Q\x86\x84P\x86\x84Q{}O{}J\x7f\x7fO\x7f\x7fL\x81\x81N\x81\x81Q\x80\x80K\x80\x80J\x81\x7fK\x81\x7fO}\x80N}\x80Q\x86\x82Q\x86\x82H}~N}~O{yO{yEr\x81Gr\x81S\x7f~O\x7f~O}\x80I}\x80S\x85\x86T\x85\x86Jy\x80Ly\x80P\x80\x84Q\x80\x84M\x82\x84M\x82\x84O\x80{R\x80{L\x7f}O\x7f}M~\x80I~\x80M|\x81K|\x81Ew~Fw~M\x82\x80L\x82\x80J|\x83O|\x83K{|L{|Ez\x87Jz\x87O{\x7fL{\x7fI}\x81L}\x81My\x80Py\x80N\x84\x81N\x84\x81M{\x88J{\x88Lz\x85Nz\x85?\x88\x80A\x88\x80J|\x86G|\x86Fx~Ex~G\x85~E\x85~E\x83\x8bH\x83\x8bD\x80\x82E\x80\x82H~\x84E~\x84Dz\x84Bz\x84Bx\x85Fx\x85E~\x84G~\x84=w\x82>w\x82E\x86\x7fE\x86\x7f>y\x81?y\x81E}\x86C}\x86@}\x87;}\x87F}\x81F}\x81<\x80\x7f;\x80\x7fA\x7f\x86A\x7f\x86Cy\x84Dy\x84?s\x82?s\x82;|\x85=|\x85>\x85\x83<\x85\x83A|\x87@|\x878\x84\x827\x84\x822\x8b\x879\x8b\x87:z\x862z\x86M|\x7fQ|\x7fP\x92|S\x92|W\x88~R\x88~I\x8a\x80H\x8a\x80L\x86}O\x86}R\x8b~U\x8b~R\x8a\x7fS\x8a\x7fP\x91}U\x91}V\x87~V\x87~T\x86\x7fQ\x86\x7fQ\x83}P\x83}N\x82zS\x82zR\x8b\x80S\x8b\x80U\x89{T\x89{X\x83{X\x83{L{\x80K{\x80T\x85\x7fS\x85\x7fR\x89\x81R\x89\x81Q\x82zQ\x82zQ\x7fzR\x7fzTu~Pu~U\x87\x81P\x87\x81R\x8b~P\x8b~M\x87\x86N\x87\x86Kx~Ox~N\x8d\x83P\x8d\x83N\x87|Q\x87|W\x85\x7fT\x85\x7fR\x7f\x82Q\x7f\x82N\x86\x80L\x86\x80L\x86\x80K\x86\x80M\x80~F\x80~N\x7f\x7fU\x7f\x7fO\x80\x81L\x80\x81L\x7f}K\x7f}L}}R}}R\x84\x7fQ\x84\x7fO\x80\x80O\x80\x80Ly\x7fQy\x7fQ\x85\x80N\x85\x80Rw\x87Qw\x87P\x87\x81Q\x87\x81N~\x82N~\x82J|yL|yL\x82\x84O\x82\x84M|\x84O|\x84M\x80\x81M\x80\x81Kx\x82Mx\x82Lx\x81Lx\x81L~\x82P~\x82N{~P{~Lw\x81Ow\x81J|}F|}Ls\x82Ls\x82D\x81\x85D\x81\x85Gt\x80Et\x80Kz\x80Iz\x80D\x80\x81F\x80\x81E\x80\x85F\x80\x85Iz\x82Fz\x82G|\x86F|\x86Fy\x82Gy\x82Hr\x80Fr\x80B\x80\x80@\x80\x80C\x7f\x82B\x7f\x82Fx\x80Hx\x80Cx\x85Hx\x85B}\x80E}\x80;w\x83<w\x83@|\x82@|\x82B{~B{~@\x83\x81?\x83\x81Bw\x7f?w\x7fBz\x88?z\x886x\x827x\x82<|\x81=|\x814\x81\x871\x81\x87Hv\x85;v\x85?\x87\x84N\x87\x848z\x82<z\x82F\x7f}N\x7f}Q\x8awR\x8awO\x8f|N\x8f|U\x84}T\x84}N{\x84H{\x84S\x8a~S\x8a~O\x8c|R\x8c|M\x84\x80S\x84\x80P\x82wS\x82wP\x89}M\x89}P\x89zS\x89zM\x84\x7fR\x84\x7fL\x86\x82N\x86\x82T\x80~U\x80~J\x89\x81K\x89\x81O\x7fzS\x7fzOy\x80Ny\x80R\x84\x7fP\x84\x7fQ|yM|yN\x80{M\x80{M}\x7fN}\x7fR\x88\x80Q\x88\x80J|\x7fN|\x7fS}\x81Q}\x81M\x84}M\x84}P\x8c\x80R\x8c\x80Q\x8a\x80O\x8a\x80R\x82\x7fN\x82\x7fQ\x83\x7fJ\x83\x7fU\x82\x84U\x82\x84M\x7f\x83Q\x7f\x83N\x7f\x81S\x7f\x81P\x83\x82L\x83\x82N\x81}M\x81}I\x82\x7fF\x82\x7fQ}\x82U}\x82N\x81\x7fL\x81\x7fN\x86\x81P\x86\x81M~\x7fJ~\x7fQ\x83}P\x83}O\x85\x7fL\x85\x7fG\x82{H\x82{P\x7f~N\x7f~K\x81~J\x81~F\x85\x80J\x85\x80O\x7f\x85Q\x7f\x85Py\x7fMy\x7fM~\x7fM~\x7fG\x81\x84K\x81\x84J|\x80J|\x80I\x82\x81Q\x82\x81P\x7f\x83L\x7f\x83H\x81\x81H\x81\x81I{\x86H{\x86I\x80\x7fJ\x80\x7fCz{Dz{Jx~Fx~H\x83\x83H\x83\x83?~~D~~F\x86\x81D\x86\x81D\x85\x80H\x85\x80D\x81\x82B\x81\x82B|\x87C|\x87Ex\x80Ex\x80?w\x88Aw\x88E\x84\x85H\x84\x85E~\x81I~\x81A}\x85A}\x85D\x81~A\x81~=\x84\x82?\x84\x82=\x7f\x80?\x7f\x80Ay\x82Ay\x82D}\x82?}\x82=z\x829z\x82:v\x819v\x81Xy}Ry}@y\x81My\x81Gv\x84@v\x84Gw\x85Ew\x859\x84\x87:\x84\x87Py\x80Ry\x80Q\x8b~N\x8b~L\x86yQ\x86yV\x88\x80S\x88\x80Q\x8b\x81S\x8b\x81O\x86\x80K\x86\x80U\x86{V\x86{O\x93}O\x93}Q\x84{Q\x84{T\x87\x80S\x87\x80R\x87\x82R\x87\x82V\x84{W\x84{O\x89xP\x89xU\x86xV\x86xQ\x87~R\x87~N\x87~P\x87~M\x81\x80T\x81\x80U|\x80P|\x80Z{\x80U{\x80K}\x81M}\x81T\x87\x83M\x87\x83Q\x82xP\x82xM\x84\x84R\x84\x84R|\x81M|\x81L\x80}K\x80}O\x84~O\x84~R\x89}O\x89}Q\x85\x80S\x85\x80T\x84\x80U\x84\x80P\x82\x83M\x82\x83M\x7fzO\x7fzS\x80\x81N\x80\x81W\x81\x87R\x81\x87O\x82\x7fO\x82\x7fJ\x86~J\x86~L\x83\x81Q\x83\x81Rw\x82Ww\x82M|\x81K|\x81Q\x87\x84Q\x87\x84Q\x86\x83O\x86\x83P\x85\x7fO\x85\x7fN\x7f\x80O\x7f\x80S~\x83S~\x83N\x85\x7fK\x85\x7fK\x82\x86M\x82\x86Ku\x7fPu\x7fJx~Lx~P}\x82R}\x82I}\x7fL}\x7fL}\x80K}\x80L\x84\x81K\x84\x81Rx\x89Qx\x89Mx\x80Jx\x80L\x7f\x85H\x7f\x85M\x83\x85M\x83\x85K\x83\x82H\x83\x82F\x80\x80H\x80\x80M\x81\x86I\x81\x86J\x80\x87K\x80\x87H\x85yI\x85yDx\x8aCx\x8aB}~E}~K\x7f~I\x7f~J\x80\x80I\x80\x80B~\x7fC~\x7fJ\x83\x80I\x83\x80H~\x81J~\x81@|\x82=|\x82?y\x80?y\x80E\x87\x7fE\x87\x7fGt\x80Ht\x80Cx\x81Dx\x81C\x8b\x85D\x8b\x856z\x829z\x827u\x876u\x87>y\x876y\x87@y\x88Cy\x881\x84\x86:\x84\x86Gy\x88;y\x88Y{\x83_{\x83J\x81\x84R\x81\x84P\x8e\x80Q\x8e\x80R\x88~R\x88~R\x8a\x7fT\x8a\x7fS\x8e|Q\x8e|N\x83\x81M\x83\x81T\x89{T\x89{T\x89\x80Q\x89\x80T\x86\x7fS\x86\x7fO\x8c|R\x8c|T\x8e\x81U\x8e\x81M\x88\x80Q\x88\x80S\x89\x81S\x89\x81Q\x83\x81R\x83\x81U\x86xN\x86xM\x86|Q\x86|T\x84\x80U\x84\x80O}}Q}}P\x84\x7fR\x84\x7fP|\x7fP|\x7fL\x86}O\x86}S}|S}|T\x8a\x82V\x8a\x82Q}~R}~R\x87\x7fP\x87\x7fO|\x81R|\x81M\x88~S\x88~Ry\x7fRy\x7fP\x85\x80P\x85\x80N\x87\x81O\x87\x81R\x80\x81T\x80\x81P\x83}N\x83}R}\x7fM}\x7fQ~~P~~Q\x81\x83N\x81\x83S~\x80P~\x80Ns|Qs|R\x81\x85S\x81\x85T\x85\x81N\x85\x81P{}O{}O|\x7fO|\x7fT\x82\x81S\x82\x81Q\x82\x86Q\x82\x86M\x7f\x82J\x7f\x82O\x81\x86O\x81\x86O|}M|}Is\x81Os\x81Kx\x85Gx\x85NrzKrzK{\x7fL{\x7fG}\x81G}\x81K\x89\x80J\x89\x80J|\x80L|\x80I}\x86K}\x86K{~L{~G\x80\x87K\x80\x87Hw\x82Hw\x82E\x82~E\x82~C\x84}E\x84}G}\x80L}\x80H|\x83H|\x83K}\x88O}\x88I{\x85G{\x85L\x84\x82K\x84\x82G\x80\x80I\x80\x80F\x7f\x82E\x7f\x82C\x80\x81E\x80\x81D{\x7fA{\x7fCz\x83Bz\x83C\x7f\x86F\x7f\x86D~\x88F~\x88A~\x83@~\x83>\x80\x80;\x80\x80@\x86\x85@\x86\x85?{\x81Z{\x81Gk\x838k\x83m~~a~~F\x82}T\x82}G\x80~F\x80~X|\x80N|\x80F\x7f~R\x7f~Q\x84\x80R\x84\x80U\x8b\x80S\x8b\x80P\x8a\x80Q\x8a\x80I\x8byL\x8byV\x8avM\x8avN\x89\x7fR\x89\x7fL}~P}~V\x81\x83O\x81\x83M\x88\x80Q\x88\x80U\x8a\x7fU\x8a\x7fO\x86\x7fM\x86\x7fS\x88{U\x88{R\x7f\x81Q\x7f\x81R\x88~P\x88~N\x83{J\x83{T\x80\x7fS\x80\x7fR\x84\x83Q\x84\x83N\x83\x81P\x83\x81Qy\x7fSy\x7fK\x80}L\x80}P\x83\x81P\x83\x81P\x83}R\x83}T\x85\x85V\x85\x85P\x84\x80R\x84\x80J\x86\x7fN\x86\x7fT}}O}}X\x86\x80U\x86\x80W\x80\x80S\x80\x80S}\x84R}\x84Q\x82\x84T\x82\x84R\x83\x80Q\x83\x80S\x80}S\x80}U\x80\x84U\x80\x84U|\x81Q|\x81S\x80{U\x80{O{\x7fN{\x7fPy\x80Sy\x80R\x82\x7fR\x82\x7fQ{\x85O{\x85S}\x81O}\x81T~\x86T~\x86Q\x80\x87T\x80\x87Q\x84\x84M\x84\x84L~\x80L~\x80Qz\x80Mz\x80Lv\x85Mv\x85L\x81\x82M\x81\x82M\x81~M\x81~H|\x85L|\x85M{\x81M{\x81Hy\x81My\x81Iw\x80Kw\x80K\x7f}G\x7f}F\x80\x83G\x80\x83N{\x80K{\x80My\x82Ky\x82I}\x87K}\x87K\x84\x83E\x84\x83A\x80\x7fB\x80\x7fK\x81\x85L\x81\x85H\x82\x85H\x82\x85E{\x80H{\x80Fz~Hz~Jt\x82Gt\x82I\x81\x82J\x81\x82D\x80\x87B\x80\x87Ev\x82Dv\x82I\x80\x81H\x80\x81F\x82\x8cI\x82\x8cB\x82\x80D\x82\x80D\x82\x87B\x82\x87Aw\x83@w\x83:z}7z}>{\x80H{\x805y\x895y\x89Aw\x856w\x85Qz\x85Uz\x85<\x82\x84L\x82\x84Tp\x89Fp\x89E\x80\x82P\x80\x82L\x84{M\x84{V\x8a\x85S\x8a\x85V\x87\x83X\x87\x83N\x8b}Q\x8b}V\x91\x81R\x91\x81J\x87\x7fM\x87\x7fR\x85yP\x85yT\x89}S\x89}P\x8a~O\x8a~U~}W~}Q\x86\x7fQ\x86\x7fV\x88yT\x88yL\x87zL\x87zS~xQ~xZ~~W~~Mx\x81Nx\x81O\x85\x82U\x85\x82L\x84}L\x84}S\x82}V\x82}Q\x83zP\x83zU\x7f\x7fT\x7f\x7fT\x89\x85S\x89\x85U\x7f\x80S\x7f\x80I|}L|}H\x84}F\x84}N\x82\x82O\x82\x82P\x83\x84O\x83\x84N\x89\x7fN\x89\x7fR\x84\x81R\x84\x81P\x82~K\x82~Pr|Kr|Lw\x80Ow\x80N\x82\x83Q\x82\x83Nx\x7fNx\x7fFy\x7fNy\x7fX|\x84P|\x84P\x7f\x7fO\x7f\x7fM\x85\x82Q\x85\x82U\x80\x80Q\x80\x80Py\x7fNy\x7fO\x82\x7fR\x82\x7fR\x84\x84S\x84\x84Q}\x83S}\x83N}\x80I}\x80Q\x82\x80N\x82\x80I\x82\x82I\x82\x82K~\x82N~\x82O\x81\x84L\x81\x84N\x80\x80L\x80\x80R\x82\x83P\x82\x83Q|\x81T|\x81K}\x7fM}\x7fN\x7f\x80I\x7f\x80K\x82\x85K\x82\x85Jy\x83Jy\x83K\x82\x82G\x82\x82I|\x81J|\x81H\x80\x85L\x80\x85N~\x82N~\x82L\x82\x86I\x82\x86B\x81\x84F\x81\x84Hz~Ez~F\x80~H\x80~H~\x80E~\x80E\x82\x80I\x82\x80E~\x7fG~\x7fE{\x81E{\x81I\x82~K\x82~E}\x85H}\x85=\x82}@\x82}?y~?y~<x\x7f=x\x7fCx\x84Ax\x84w{zn{zHz~az~Hvz?vzUz\x7fKz\x7fGv\x86Pv\x86E\x85\x87C\x85\x87H\x81\x83M\x81\x83O\x86\x85Q\x86\x85M\x82\x81L\x82\x81O\x7f\x84N\x7f\x84S\x85\x80P\x85\x80U\x85\x80T\x85\x80P\x84\x7fO\x84\x7fN\x80|L\x80|U\x86\x7fS\x86\x7fT\x82\x84Q\x82\x84M\x87{M\x87{N\x87uL\x87uL\x88\x7fL\x88\x7fM\x87\x80P\x87\x80T\x86\x80R\x86\x80N\x85\x7fS\x85\x7fH\x80\x82I\x80\x82S|~V|~Qu}Pu}S\x87}T\x87}U\x82\x80R\x82\x80M\x88\x86S\x88\x86Q\x7f\x86O\x7f\x86Qx\x81Ux\x81T{}S{}Q\x89\x83N\x89\x83O\x83}Q\x83}T~\x82O~\x82N\x80\x81N\x80\x81T\x80}V\x80}S~\x81Q~\x81M\x81\x80O\x81\x80Ry\x7fOy\x7fPs\x81Qs\x81P\x7f\x80P\x7f\x80N\x81~R\x81~Q\x86\x82P\x86\x82Q\x84\x81O\x84\x81R\x84\x82S\x84\x82P{\x84U{\x84O{\x7fO{\x7fS\x82\x82T\x82\x82T~\x82U~\x82P\x81\x85O\x81\x85R\x83\x80O\x83\x80V\x80~R\x80~T~\x83N~\x83J\x82\x81M\x82\x81K\x83\x85M\x83\x85O{\x81R{\x81Nz\x80Mz\x80O\x80\x81O\x80\x81L\x81|K\x81|M|\x86L|\x86I\x87\x84J\x87\x84I\x83\x83L\x83\x83H{\x82G{\x82Lq~Oq~Hx\x82Kx\x82E\x7f\x82J\x7f\x82N{\x85M{\x85J|\x7fL|\x7fCv\x84Bv\x84K\x7f\x86K\x7f\x86G\x7f~K\x7f~I}\x85K}\x85B\x7f\x80C\x7f\x80Cz\x80Bz\x80?...

That's not the whole string, it is much longer. What I know is that it is a 160*120 image and it uses YUV colorspace. It has 3 layers.

The documentation to the library I'm using does not provide any example how to decode this string into an image so I need some help with it. I seems that the string contains information about pixels but I do not understand the format of the string.

I have found this C++ function to convert YUV to RGB but I don't know how to use it on the string I have. Any ideas?

void yuvToRgb(byte *y, byte *u, byte *v, byte *r, byte *g, byte *b) {
    int c = (*y) - 16;
    int d = (*u) - 128;
    int e = (*v) - 128;
    int R = (298 * c) + (409 * e) + (128);
    int G = (298 * c) - (100 * d) - (208 * e) + 128;
    int B = (298 * c) + (516 * d) + (128);
    R >>= 8;
    G >>= 8;
    B >>= 8;
    //Change the values
    (*r) = clip(R);
    (*g) = clip(G);
    (*b) = clip(B);
}
+2  A: 

The data looks to me like 4:4:4 YUV with the data samples interleaved rather than planar. Converting that to English, the bytes decode as

Y1 U1 V1 Y2 U2 V2 Y3 U3 V3 ...

so the Y, U and V values of the first pixel, then of the second pixel, and so on.

I'm guessing at that because of the good correllation between every third value. This should make it pretty straightforward to convert to an RGB triple using the code you have.

Once you have the RGB triples it's likely that they will be in a simple scan, so knowing that it's 160x120 is very useful (i.e. the first 160 RGB value are the top line, the next 160 the 2nd line and so on).

My completely untested translation of the C++ code to Python (2.6+) would be something like this:

def clip(v):
    # Clip to 0-255
    v = max(v, 0)
    v = min(v, 255)
    return v

def yuvToRgb(y, u, v):
    c = y - 16
    d = u - 128
    e = v - 128
    R = (298 * c) + (409 * e) + 128
    G = (298 * c) - (100 * d) - (208 * e) + 128
    B = (298 * c) + (516 * d) + 128
    R >>= 8
    G >>= 8
    B >>= 8
    return (clip(R), clip(G), clip(B))

b = bytearray('\x84K\x7f\x86K\x7f\x86G\x7f~K\x7f~I}\x85K}\x85') # etc...
RGB = []
for i in xrange(0, len(b), 3):
    RGB.append(yuvToRgb(b[3*i], b[3*i+1], b[3*i+2]))

I hope that's useful to you.

An alternative method would be just to use the Python Imaging Library. I'm not too familiar with it myself, but if you go in assuming it's 160x120 interleaved 4:4:4 YUV then it might be quite easy.

Scott Griffiths
Thanks for very helpful answer. I have actually decided to use the PIL image processing library for Python. It has a function precisely for this and it is very easy: im = Image.fromstring("YCbCr",(imageWidth,imageHeight),imageByteArray) - works like charm.
Richard Knop
That's good (I just found the same function). I've been meaning to learn some PIL for a while as I've heard only good things about it.
Scott Griffiths