|
楼主 |
发表于 2020-9-6 22:27:49
|
显示全部楼层
本帖最后由 枪兵打巨像 于 2020-10-19 18:51 编辑
编码表获取方法:
1、用PR或者AE把《Bad Apple!!》原版视频输出为图片序列。由于PR只支持常规帧率输出,不支持16帧的特殊帧率输出,所以以下以AE举例说明:
(1) 将视频拖入AE渲染轨道内,点击输出模式,输出格式选择"JPEG Sequence",分辨率设定为80*60(根据实际需要设定)↓↓↓
(2) 点击渲染设置,将帧率设定为16(根据实际需要设定)↓↓↓
(3) 设定图片序列命名规则,选择图片输出路径,最后点击"Render"输出图片序列 ↓↓↓
(4) 输出的图片序列如下所示,按16帧的帧率,最终输出了3504张帧画面 ↓↓↓
2、使用Matlab的 rgb2gray函数 处理图片序列,遍历每一张帧画面的所有像素点,获取像素点的灰度值,输出编码表。
如果灰度值大于200,则输出"0",否则输出"1"。Matlab代码如下 ↓↓↓
- str='C:\\Picture queue\picture queue 4\BA';
- FID=fopen('C:\\Pixel\BA4.txt','a+');
- for i=1:10
- I=imread([str,'000',num2str(i-1),'.jpg']);
- I1=rgb2gray(I);
- for i1=1:60
- for i2=1:80
- if(I1(i1,i2)>200)
- fprintf(FID,'0 ');
- else
- fprintf(FID,'1 ');
- end
- end
- fprintf(FID,'\r\n');
- end
- end
- for i=11:100
- I=imread([str,'00',num2str(i-1),'.jpg']);
- I1=rgb2gray(I);
- for i1=1:60
- for i2=1:80
- if(I1(i1,i2)>200)
- fprintf(FID,'0 ');
- else
- fprintf(FID,'1 ');
- end
- end
- fprintf(FID,'\r\n');
- end
- end
- for i=101:1000
- I=imread([str,'0',num2str(i-1),'.jpg']);
- I1=rgb2gray(I);
- for i1=1:60
- for i2=1:80
- if(I1(i1,i2)>200)
- fprintf(FID,'0 ');
- else
- fprintf(FID,'1 ');
- end
- end
- fprintf(FID,'\r\n');
- end
- end
- for i=1001:3504
- I=imread([str,num2str(i-1),'.jpg']);
- I1=rgb2gray(I);
- for i1=1:60
- for i2=1:80
- if(I1(i1,i2)>200)
- fprintf(FID,'0 ');
- else
- fprintf(FID,'1 ');
- end
- end
- fprintf(FID,'\r\n');
- end
- end
- sta=fclose(FID);
复制代码
3、Matlab输出的文本格式编码表 ↓↓↓
4、将文本格式的编码表导入Excel,进行后续处理 ↓↓↓
5、使用Excel VBA将编码表转化为Galaxy字符串。
由于Galaxy字符串的长度限制为2045个字符,而每一帧有80*60=4800个"0/1"字符编码,所以设定每一个字符串存储每一帧1/3的字符编码,即1600个字符编码。
Excel VBA代码如下 ↓↓↓
- Sub GalaxyPixel()
- Dim i As Long
- Dim j As Long
- Dim k As Long
- Dim n1 As Long
- Dim n2 As Long
- Dim n3 As Long
- Dim Pixel As Long
- Dim PixelArray As String
- For k = 1 To 3504
- PixelArray = ""
- For i = 1 To 20
- For j = 1 To 80
- n1 = 3 * k - 2
- Pixel = Sheet1.Cells((k - 1) * 60 + i, j)
- PixelArray = PixelArray & Pixel
- Next j
- Next i
- Sheet3.Cells(n1, 1) = "p1[" & k & "]=""" & PixelArray & """;"
- Next k
- For k = 1 To 3504
- PixelArray = ""
- For i = 21 To 40
- For j = 1 To 80
- n2 = 3 * k - 1
- Pixel = Sheet1.Cells((k - 1) * 60 + i, j)
- PixelArray = PixelArray & Pixel
- Next j
- Next i
- Sheet3.Cells(n2, 1) = "p2[" & k & "]=""" & PixelArray & """;"
- Next k
- For k = 1 To 3504
- PixelArray = ""
- For i = 41 To 60
- For j = 1 To 80
- n3 = 3 * k
- Pixel = Sheet1.Cells((k - 1) * 60 + i, j)
- PixelArray = PixelArray & Pixel
- Next j
- Next i
- Sheet3.Cells(n3, 1) = "p3[" & k & "]=""" & PixelArray & """;"
- Next k
- End Sub
复制代码
6、Excel VBA输出的Galaxy字符串,可以直接复制到Galaxy编辑器中使用 ↓↓↓
|
|