MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

https://about.gitlab.com/releases/2022/01/11/security-release-gitlab-14-6-2-released/
https://about.gitlab.com/releases/2022/01/04/gitlab-14-6-1-released/

Commit e70fd4d1 authored by BRUNEAU Julien's avatar BRUNEAU Julien
Browse files

+ add resolution in recorder config

parent 25aea845
......@@ -10,6 +10,9 @@ public abstract class Filter
public int quality;
public bool supportsAntialiasing;
public bool needsRescale;
public int width=1920;
public int height=1080;
// impl
public Shader filter;
......@@ -68,6 +71,8 @@ public class FilterSegmentation : Filter
public override void initParams()
{
quality = ConfigReader.imgSegmentation.quality;
width = ConfigReader.imgSegmentation.width;
height = ConfigReader.imgSegmentation.height;
}
public override void OnSceneChange(Renderer r, ref MaterialPropertyBlock mpb)
......@@ -95,6 +100,8 @@ public class FilterCategory : Filter
public override void initParams()
{
quality = ConfigReader.imgCategories.quality;
width = ConfigReader.imgCategories.width;
height = ConfigReader.imgCategories.height;
}
public override void OnSceneChange(Renderer r, ref MaterialPropertyBlock mpb)
......@@ -128,6 +135,8 @@ public class FilterDepth : Filter
public override void initParams()
{
quality = ConfigReader.imgDepth.quality;
width = ConfigReader.imgDepth.width;
height = ConfigReader.imgDepth.height;
maxDist = ConfigReader.imgDepth.maxDepth;
minDist = ConfigReader.imgDepth.minDepth;
......@@ -162,6 +171,8 @@ public class FilterNormal : Filter
public override void initParams()
{
quality = ConfigReader.imgNormals.quality;
width = ConfigReader.imgNormals.width;
height = ConfigReader.imgNormals.height;
}
}
......@@ -193,6 +204,8 @@ public class FilterOpticalFlow : Filter
public override void initParams()
{
quality = ConfigReader.imgOpticalFlow.quality;
width = ConfigReader.imgOpticalFlow.width;
height = ConfigReader.imgOpticalFlow.height;
motionVector = ConfigReader.imgOpticalFlow.motionVector;
if (motionVector && !(quality == 16 || quality == 32))
......
......@@ -189,11 +189,6 @@ public class FiltersControl : MonoBehaviour
public void Save(string filename, int width = -1, int height = -1, string path = "")
{
if (width <= 0 || height <= 0)
{
width = Screen.width;
height = Screen.height;
}
var filenameExtension = System.IO.Path.GetExtension(filename);
if (filenameExtension == "")
......@@ -222,7 +217,10 @@ public class FiltersControl : MonoBehaviour
if (!System.IO.Directory.Exists(subPath))
System.IO.Directory.CreateDirectory(subPath);
Save(mainCam, Path.Combine(subPath, filenameWithoutExtension), width, height, true, false);
if (ConfigReader.imgOriginal.width==-1 || ConfigReader.imgOriginal.height==-1)
Save(mainCam, Path.Combine(subPath, filenameWithoutExtension), width, height, true, false, ConfigReader.imgOriginal.quality);
else
Save(mainCam, Path.Combine(subPath, filenameWithoutExtension), ConfigReader.imgOriginal.width, ConfigReader.imgOriginal.height, true, false, ConfigReader.imgOriginal.quality);
}
foreach (var f in filters)
......@@ -240,13 +238,22 @@ public class FiltersControl : MonoBehaviour
if (!System.IO.Directory.Exists(subPath))
System.IO.Directory.CreateDirectory(subPath);
Save(f.camera, Path.Combine(subPath, filenameWithoutExtension), width, height, f.supportsAntialiasing, f.needsRescale, f.quality);
if (f.width==-1 || f.height==-1)
Save(f.camera, Path.Combine(subPath, filenameWithoutExtension), width, height, f.supportsAntialiasing, f.needsRescale, f.quality);
else
Save(f.camera, Path.Combine(subPath, filenameWithoutExtension), f.width, f.height, f.supportsAntialiasing, f.needsRescale, f.quality);
}
}
}
private void Save(Camera cam, string filename, int width, int height, bool supportsAntialiasing, bool needsRescale, int quality=8)
{
if (width <= 0 || height <= 0)
{
width = Screen.width;
height = Screen.height;
}
var mainCamera = GetComponent<Camera>();
var depth = 24;
var format = RenderTextureFormat.ARGBFloat;
......@@ -280,8 +287,6 @@ public class FiltersControl : MonoBehaviour
tex.ReadPixels(new Rect(0, 0, tex.width, tex.height), 0, 0);
tex.Apply();
Debug.Log(tex.GetPixels(500, 500, 1, 1)[0]);
// encode texture into PNG
byte[] bytes;
if (quality==32)
......@@ -298,7 +303,6 @@ public class FiltersControl : MonoBehaviour
{
bytes = tex.EncodeToPNG();
filename = filename + ".png";
}
File.WriteAllBytes(filename, bytes);
......
......@@ -90,7 +90,7 @@ public class CamRecorder : MonoBehaviour
//ScreenCapture.CaptureScreenshot(saveDir + "Images/" + imageIncrement.ToString("D" + 4) + ".png");
this.GetComponent<FiltersControl>().Save(imageIncrement.ToString("D" + 4) + ".png",-1,-1, saveDir);
this.GetComponent<FiltersControl>().Save(imageIncrement.ToString("D" + 4) + ".png",ConfigReader.recordingWidth,ConfigReader.recordingHeight, saveDir);
// Record data need for deep learning
foreach (DeepRecorder rec in gameObject.GetComponentsInChildren<DeepRecorder>())
......
......@@ -190,6 +190,20 @@ public static class ConfigReader
{
get { return data.recording.saveDir; }
}
/// <summary>
/// time to start the recording of the animation
/// </summary>
static public int recordingWidth
{
get { return data.recording.width; }
}
/// <summary>
/// time to start the recording of the animation
/// </summary>
static public int recordingHeight
{
get { return data.recording.height; }
}
/// <summary>
/// Indicate if body bounding boxes should be recorded
......@@ -424,6 +438,10 @@ public class ConfigRecording
public float end;
[XmlAttribute]
public int framerate;
[XmlAttribute]
public int width;
[XmlAttribute]
public int height;
public DataImgOriginal saveImgOriginal;
public DataImgSegmentation saveImgSegmentation;
......@@ -443,7 +461,9 @@ public class ConfigRecording
start = 0;
end = 0;
framerate = 15;
width = -1;
height = -1;
saveDir = ".\\Output\\";
saveImgOriginal = new DataImgOriginal();
......@@ -463,6 +483,10 @@ public class DataImgOriginal
public bool record = true;
[XmlAttribute]
public int quality = 8;
[XmlAttribute]
public int width = -1;
[XmlAttribute]
public int height = -1;
}
public class DataImgSegmentation
{
......@@ -470,6 +494,10 @@ public class DataImgSegmentation
public bool record = false;
[XmlAttribute]
public int quality = 8;
[XmlAttribute]
public int width = -1;
[XmlAttribute]
public int height = -1;
}
public class DataImgCategories
{
......@@ -477,6 +505,10 @@ public class DataImgCategories
public bool record = false;
[XmlAttribute]
public int quality = 8;
[XmlAttribute]
public int width = -1;
[XmlAttribute]
public int height = -1;
}
public class DataImgDepth
......@@ -486,6 +518,10 @@ public class DataImgDepth
[XmlAttribute]
public int quality = 8;
[XmlAttribute]
public int width = -1;
[XmlAttribute]
public int height = -1;
[XmlAttribute]
public float minDepth=0;
[XmlAttribute]
public float maxDepth=50;
......@@ -499,6 +535,10 @@ public class DataImgNormals
public bool record = false;
[XmlAttribute]
public int quality = 8;
[XmlAttribute]
public int width = -1;
[XmlAttribute]
public int height = -1;
}
public class DataImgOpticalFlow
......@@ -508,6 +548,10 @@ public class DataImgOpticalFlow
[XmlAttribute]
public int quality = 8;
[XmlAttribute]
public int width = -1;
[XmlAttribute]
public int height = -1;
[XmlAttribute]
public bool motionVector = false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment