I am creating an app where do some image processing on the onPreviewFrame and then generate the Y, U and V values of each frame. I then stored these values into an ArrayList.
example from the log (Y, U , V)
10-08 05:06:10.941 20405-20405/redlight55.com.bpreader D/MyEntryData: [1590690, 2700692, 5731888]
10-08 05:06:10.998 20405-20405/redlight55.com.bpreader D/MyEntryData: [1610252, 2699200, 5760320]
10-08 05:06:11.014 20405-20405/redlight55.com.bpreader D/MyEntryData: [1612862, 2700420, 5763556]
10-08 05:06:11.089 20405-20405/redlight55.com.bpreader D/MyEntryData: [1617378, 2699508, 5770000]
I want to store these data into a CSV file which will be saved in the internal storage of the device. They should be stored as something like this
this is the method where i am saving and generating the log for the ArrayList
@Override
public void onPreviewFrame(int ySum, int uSum, int vSum) {
img_Y_Avg = ySum;
img_U_Avg = uSum;
img_V_Avg = vSum;
//set value of Y on the text view
TextView valueOfY = (TextView)findViewById(R.id.valueY);
valueY = img_Y_Avg;
valueOfY.setText(Double.toString(img_Y_Avg));
//set value of U on the text view
TextView valueOfU = (TextView)findViewById(R.id.valueU);
valueU = img_U_Avg;
valueOfU.setText(Double.toString(img_U_Avg));
//set value of V on the text view
TextView valueOfV = (TextView)findViewById(R.id.valueV);
valueV = img_V_Avg;
valueOfV.setText(Double.toString(img_V_Avg));
//store value to array list
ArrayList<Integer> yAverage = new ArrayList<Integer>();
yAverage.add(img_Y_Avg);
//Log.d("MyEntryData", String.valueOf(yAverage));
//store u values to array
ArrayList<Integer> uAverage = new ArrayList<Integer>();
uAverage.add(img_U_Avg);
//Log.d("MyEntryData", String.valueOf(uAverage));
//store u values to array
ArrayList<Integer> vAverage = new ArrayList<Integer>();
vAverage.add(img_V_Avg);
//Log.d("MyEntryData", String.valueOf(vAverage));
ArrayList<Integer> getValues = new ArrayList<Integer>();
for(int i = 0; i < uAverage.size(); i++) {
getValues.add(yAverage.get(i));
getValues.add(uAverage.get(i));
getValues.add(vAverage.get(i));
}
Log.d("MyEntryData", String.valueOf(getValues));
handler = new Handler();
final Runnable runnable = new Runnable() {
@Override
public void run() {
readingRemaining = readingRemaining -1;
if (readingRemaining > 0){
plotGraph(img_Y_Avg);
}
}
};
handler.postDelayed(runnable, 100);
//Log.d("MyEntryData", String.valueOf(img_Y_Avg +" "+ img_U_Avg+" "+img_V_Avg));
}
i have been trying to do it with opencsv but there are no files generated into the device storage. How can i do this?
