Fix BGR-RGB bug

This commit is contained in:
Ruben van de Ven 2022-11-26 20:40:15 +01:00
parent 73ce5c4bfd
commit af10780d4f

View file

@ -336,7 +336,7 @@
"id": "efafbb3a-7d2c-4b6a-a626-f06dd1b2b1ec", "id": "efafbb3a-7d2c-4b6a-a626-f06dd1b2b1ec",
"metadata": {}, "metadata": {},
"source": [ "source": [
"Interpolation of vectors, to browse latent space." "## Interpolation of vectors; browsing latent space."
] ]
}, },
{ {
@ -539,7 +539,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 48, "execution_count": 40,
"id": "7fd5f974-3f44-4f92-b1b8-7564400229fa", "id": "7fd5f974-3f44-4f92-b1b8-7564400229fa",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
@ -549,7 +549,7 @@
"def generator_to_video(generator, out_filename, fps, frame_size, quality):\n", "def generator_to_video(generator, out_filename, fps, frame_size, quality):\n",
" writer = write_frames(out_filename, frame_size, quality=quality) # size is (width, height)\n", " writer = write_frames(out_filename, frame_size, quality=quality) # size is (width, height)\n",
" writer.send(None) # seed the generator\n", " writer.send(None) # seed the generator\n",
" print(os.path.abspath(out_filename))\n", " # print(os.path.abspath(out_filename))\n",
" # output = cv2.VideoWriter(\n", " # output = cv2.VideoWriter(\n",
" # out_filename,\n", " # out_filename,\n",
" # # see http://mp4ra.org/#/codecs for codecs\n", " # # see http://mp4ra.org/#/codecs for codecs\n",
@ -559,12 +559,12 @@
" for frame in generator:\n", " for frame in generator:\n",
" if type(frame) is Image.Image:\n", " if type(frame) is Image.Image:\n",
" open_cv_image = np.array(frame) \n", " open_cv_image = np.array(frame) \n",
" # Conve\n", " frame = open_cv_image\n",
" frame = open_cv_image[:, :, ::-1].copy()\n", " # Convert RGB->BGR (for openCV\n",
" # frame = open_cv_image[:, :, ::-1].copy()\n",
" # output.write(frame)\n", " # output.write(frame)\n",
" writer.send(frame)\n", " writer.send(frame)\n",
" \n", " \n",
" \n",
" # output.release()\n", " # output.release()\n",
" writer.close()" " writer.close()"
] ]