Last active
September 4, 2015 03:54
-
-
Save psxdev/4bf985f9caa54bce27ef to your computer and use it in GitHub Desktop.
Mode 0 playstation 4 decode frame for 1280x800 resolution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <opencv2/opencv.hpp> | |
#include <string> // std::string | |
#include <iostream> // std::cout | |
#include <sstream> // std::stringstream | |
#include <iomanip> // std::setfill, std::setw | |
#include<stdio.h> //SYSTEM | |
#include<iostream> | |
void convert_yuyv422_to_bgr(char *img,int x, int y) | |
{ | |
cv::Mat yuv(y,x,CV_8UC2 ,img); | |
cv::Mat rgb(y,x,CV_8UC3); | |
cv::cvtColor(yuv, rgb, CV_YUV2BGR_YUY2); | |
while(1) | |
{ | |
cv::imshow("ps4eye camera", rgb); | |
char key = cv::waitKey(1); | |
if(key == 'q') | |
break; | |
} | |
} | |
int main(int argc, char** argv) | |
{ | |
cv::namedWindow("PlayStation 4 Camera capture decoding", 1); | |
FILE *fd; | |
//mode 0 | |
char name[255]={0}; | |
int x,y,i,j; | |
x=1280; | |
y=800; | |
char *image; | |
for(i=1;i<10;i++) | |
{ | |
image=(char *)malloc(x*y*2); | |
sprintf(name,"leftframe_%d_mode_%d.raw",i,0); | |
fd=fopen(name,"rb"); | |
fread(image,x*y*2,1,fd); | |
fclose(fd); | |
convert_yuyv422_to_bgr(image,x,y); | |
sprintf(name,"rightframe_%d_mode_%d.raw",i,0); | |
fd=fopen(name,"rb"); | |
fread(image,x*y*2,1,fd); | |
fclose(fd); | |
convert_yuyv422_to_bgr(image,x,y); | |
free(image); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment