Items with no label
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
3339 Discussions

Save Frames For Future Use (UYVY Format)

JSmit77
Beginner
2,599 Views

I'm currently trying to sample a set of frames using the UYVY format. As I sample I push them back into a vector. If I try to add more than 10 elements to this vector, librealsense2 throws an exception which terminates the program. Sample code shown below.

Strangely I only have this issue when trying to save using the UYVY format, it seems to work fine using the Y8 format. Originally I had this same issue for saving in any format but the .keep() function resolved it. In the viewer the UYVY format is supported for a single IR sensor; however in order to enable it I must use cfg.enable_stream(RS2_STREAM_INFRARED, -1, 1280, 720, RS2_FORMAT_UYVY, 30); Specifying an index other than "-1" results in a thrown exception. When attempting to retrieve frames using .get_infrared_frame(), specifying an index (e.g. 1 or 2) returns a NULL pointer rather than a frame.

To summarize, I am retrieving frames, but cannot hold on to more than 10 at a time, using standard stl containers, and ".keep()" does not resolve the issue. As I am able to sample and save large quantities of frames in other formats (e.g. 500 rgb frames in 24bit rgb) I am confident I am not running out of memory. Anyone have any ideas ?

0 Kudos
1 Solution
Cary_P_Intel
Employee
1,458 Views

Hello,

I use 2.11.0 LibRS and revised rs-capture.cpp sample code to simulate your situation, the code works without problem, please have a try and let me know your feedback.

Also for index of the Left/Right IR, Y8 & Y16 are generated from each stream so if you want to get those two format, you can set stream parameter to 1 or 2. But few of the format is generated through software, if you want to retrieve those format, you have to set the index to 0. you can use the rs-sensor-control.cpp example to list down the available streams. Attached my enumeration from the sample.

Sensor provides the following stream profiles:

0 : Infrared # 2 (Video Stream: Y16 1920x1080@ 25Hz)

1 : Infrared # 1 (Video Stream: Y16 1920x1080@ 25Hz)

2 : Infrared # 1 (Video Stream: Y8 1920x1080@ 25Hz)

3 : Infrared # 2 (Video Stream: Y8 1920x1080@ 25Hz)

4 : Infrared # 2 (Video Stream: Y16 1920x1080@ 15Hz)

5 : Infrared # 1 (Video Stream: Y16 1920x1080@ 15Hz)

6 : Infrared # 1 (Video Stream: Y8 1920x1080@ 15Hz)

7 : Infrared # 2 (Video Stream: Y8 1920x1080@ 15Hz)

8 : Infrared # 0 (Video Stream: UYVY 1280x720@ 30Hz)

9 : Infrared # 1 (Video Stream: Y8 1280x720@ 30Hz)

10 : Infrared # 2 (Video Stream: Y8 1280x720@ 30Hz)

11 : Infrared # 0 (Video Stream: BGRA8 1280x720@ 30Hz)

12 : Infrared # 0 (Video Stream: RGBA8 1280x720@ 30Hz)

13 : Infrared # 0 (Video Stream: BGR8 1280x720@ 30Hz)

14 : Infrared # 0 (Video Stream: RGB8 1280x720@ 30Hz)

15 : Infrared # 0 (Video Stream: UYVY 1280x720@ 15Hz)

16 : Infrared # 1 (Video Stream: Y8 1280x720@ 15Hz)

17 : Infrared # 2 (Video Stream: Y8 1280x720@ 15Hz)

18 : Infrared # 0 (Video Stream: BGRA8 1280x720@ 15Hz)

19 : Infrared # 0 (Video Stream: RGBA8 1280x720@ 15Hz)

20 : Infrared # 0 (Video Stream: BGR8 1280x720@ 15Hz)

21 : Infrared # 0 (Video Stream: RGB8 1280x720@ 15Hz)

22 : Infrared # 0 (Video Stream: UYVY 1280x720@ 6Hz)

23 : Infrared # 2 (Video Stream: Y8 1280x720@ 6Hz)

24 : Infrared # 1 (Video Stream: Y8 1280x720@ 6Hz)

25 : Infrared # 0 (Video Stream: BGRA8 1280x720@ 6Hz)

26 : Infrared # 0 (Video Stream: RGBA8 1280x720@ 6Hz)

27 : Infrared # 0 (Video Stream: BGR8 1280x720@ 6Hz)

28 : Infrared # 0 (Video Stream: RGB8 1280x720@ 6Hz)

29 : Infrared # 2 (Video Stream: Y16 960x540@ 25Hz)

30 : Infrared # 1 (Video Stream: Y16 960x540@ 25Hz)

31 : Infrared # 1 (Video Stream: Y16 960x540@ 15Hz)

32 : Infrared # 2 (Video Stream: Y16 960x540@ 15Hz)

33 : Infrared # 0 (Video Stream: UYVY 848x480@ 90Hz)

34 : Infrared # 1 (Video Stream: Y8 848x480@ 90Hz)

35 : Infrared # 2 (Video Stream: Y8 848x480@ 90Hz)

36 : Infrared # 0 (Video Stream: BGRA8 848x480@ 90Hz)

37 : Infrared # 0 (Video Stream: RGBA8 848x480@ 90Hz)

38 : Infrared # 0 (Video Stream: BGR8 848x480@ 90Hz)

39 : Infrared # 0 (Video Stream: RGB8 848x480@ 90Hz)

40 : Infrared # 0 (Video Stream: UYVY 848x480@ 60Hz)

41 : Infrared # 2 (Video Stream: Y8 848x480@ 60Hz)

42 : Infrared # 1 (Video Stream: Y8 848x480@ 60Hz)

43 : Infrared # 0 (Video Stream: BGRA8 848x480@ 60Hz)

44 : Infrared # 0 (Video Stream: RGBA8 848x480@ 60Hz)

45 : Infrared # 0 (Video Stream: BGR8 848x480@ 60Hz)

46 : Infrared # 0 (Video Stream: RGB8 848x480@ 60Hz)

47 : Infrared # 0 (Video Stream: UYVY 848x480@ 30Hz)

48 : Infrared # 1 (Video Stream: Y8 848x480@ 30Hz)

49 : Infrared # 2 (Video Stream: Y8 848x480@ 30Hz)

50 : Infrared # 0 (Video Stream: BGRA8 848x480@ 30Hz)

51 : Infrared # 0 (Video Stream: RGBA8 848x480@ 30Hz)

52 : Infrared # 0 (Video Stream: BGR8 848x480@ 30Hz)

53 : Infrared # 0 (Video Stream: RGB8 848x480@ 30Hz)

54 : Infrared # 0 (Video Stream: UYVY 848x480@ 15Hz)

55 : Infrared # 1 (Video Stream: Y8 848x480@ 15Hz)

56 : Infrared # 2 (Video Stream: Y8 848x480@ 15Hz)

57 : Infrared # 0 (Video Stream: BGRA8 848x480@ 15Hz)

58 : Infrared # 0 (Video Stream: RGBA8 848x480@ 15Hz)

59 : Infrared # 0 (Video Stream: BGR8 848x480@ 15Hz)

60 : Infrared # 0 (Video Stream: RGB8 848x480@ 15Hz)

61 : Infrared # 0 (Video Stream: UYVY 848x480@ 6Hz)

62 : Infrared # 1 (Video Stream: Y8 848x480@ 6Hz)

63 : Infrared # 2 (Video Stream: Y8 848x480@ 6Hz)

64 : Infrared # 0 (Video Stream: BGRA8 848x480@ 6Hz)

65 : Infrared # 0 (Video Stream: RGBA8 848x480@ 6Hz)

66 : Infrared # 0 (Video Stream: BGR8 848x480@ 6Hz)

67 : Infrared # 0 (Video Stream: RGB8 848x480@ 6Hz)

68 : Infrared # 0 (Video Stream: UYVY 640x480@ 90Hz)

69 : Infrared # 1 (Video Stream: Y8 640x480@ 90Hz)

70 : Infrared # 2 (Video Stream: Y8 640x480@ 90Hz)

71 : Infrared # 0 (Video Stream: BGRA8 640x480@ 90Hz)

72 : Infrared # 0 (Video Stream: RGBA8 640x480@ 90Hz)

73 : Infrared # 0 (Video Stream: BGR8 640x480@ 90Hz)

74 : Infrared # 0 (Video Stream: RGB8 640x480@ 90Hz)

75 : Infrared # 0 (Video Stream: UYVY 640x480@ 60Hz)

76 : Infrared # 2 (Video Stream: Y8 640x480@ 60Hz)

77 : Infrared # 1 (Video Stream: Y8 640x480@ 60Hz)

78 : Infrared # 0 (Video Stream: BGRA8 640x480@ 60Hz)

79 : Infrared # 0 (Video Stream: RGBA8 640x480@ 60Hz)

80 : Infrared # 0 (Video Stream: BGR8 640x480@ 60Hz)

81 : Infrared # 0 (Video Stream: RGB8 640x480@ 60Hz)

82 : Infrared # 0 (Video Stream: UYVY 640x480@ 30Hz)

83 : Infrared # 2 (Video Stream: Y8 640x480@ 30Hz)

84 : Infrared # 1 (Video Stream: Y8 640x480@ 30Hz)

85 : Infrared # 0 (Video Stream: BGRA8 640x480@ 30Hz)

86 : Infrared # 0 (Video Stream: RGBA8 640x480@ 30Hz)

87 : Infrared # 0 (Video Stream: BGR8 640x480@ 30Hz)

88 : Infrared # 0 (Video Stream: RGB8 640x480@ 30Hz)

89 : Infrared # 0 (Video Stream: UYVY 640x480@ 15Hz)

90 : Infrared # 1 (Video Stream: Y8 640x480@ 15Hz)

91 : Infrared # 2 (Video Stream: Y8 640x480@ 15Hz)

92 : Infrared # 0 (Video Stream: BGRA8 640x480@ 15Hz)

93 : Infrared # 0 (Video Stream: RGBA8 640x480@ 15Hz)

94 : Infrared # 0 (Video Stream: BGR8 640x480@ 15Hz)

95 : Infrared # 0 (Video Stream: RGB8 640x480@ 15Hz)

96 : Infrared # 0 (Video Stream: UYVY 640x480@ 6Hz)

97 : Infrared # 1 (Video Stream: Y8 640x480@ 6Hz)

98 : Infrared # 2 (Video Stream: Y8 640x480@ 6Hz)

99 : Infrared # 0 (Video Stream: BGRA8 640x480@ 6Hz)

100: Infrared # 0 (Video Stream: RGBA8 640x480@ 6Hz)

101: Infrared # 0 (Video Stream: BGR8 640x480@ 6Hz)

102: Infrared # 0 (Video Stream: RGB8 640x480@ 6Hz)

103: Infrared # 0 (Video Stream: UYVY 640x360@ 90Hz)

104: Infrared # 2 (Video Stream: Y8 640x360@ 90Hz)

105: Infrared # 1 (Video Stream: Y8 640x360@ 90Hz)

106: Infrared # 0 (Video Stream: BGRA8 640x360@ 90Hz)

107: Infrared # 0 (Video Stream: RGBA8 640x360@ 90Hz)

108: Infrared # 0 (Video Stream: BGR8 640x360@ 90Hz)

109: Infrared # 0 (Video Stream: RGB8 640x360@ 90Hz)

110: Infrared # 0 (Video Stream: UYVY 640x360@ 60Hz)

111: Infrared # 1 (Video Stream: Y8 640x360@ 60Hz)

112: Infrared # 2 (Video Stream: Y8 640x360@ 60Hz)

113: Infrared # 0 (Video Stream: BGRA8 640x360@ ...

View solution in original post

0 Kudos
2 Replies
Cary_P_Intel
Employee
1,459 Views

Hello,

I use 2.11.0 LibRS and revised rs-capture.cpp sample code to simulate your situation, the code works without problem, please have a try and let me know your feedback.

Also for index of the Left/Right IR, Y8 & Y16 are generated from each stream so if you want to get those two format, you can set stream parameter to 1 or 2. But few of the format is generated through software, if you want to retrieve those format, you have to set the index to 0. you can use the rs-sensor-control.cpp example to list down the available streams. Attached my enumeration from the sample.

Sensor provides the following stream profiles:

0 : Infrared # 2 (Video Stream: Y16 1920x1080@ 25Hz)

1 : Infrared # 1 (Video Stream: Y16 1920x1080@ 25Hz)

2 : Infrared # 1 (Video Stream: Y8 1920x1080@ 25Hz)

3 : Infrared # 2 (Video Stream: Y8 1920x1080@ 25Hz)

4 : Infrared # 2 (Video Stream: Y16 1920x1080@ 15Hz)

5 : Infrared # 1 (Video Stream: Y16 1920x1080@ 15Hz)

6 : Infrared # 1 (Video Stream: Y8 1920x1080@ 15Hz)

7 : Infrared # 2 (Video Stream: Y8 1920x1080@ 15Hz)

8 : Infrared # 0 (Video Stream: UYVY 1280x720@ 30Hz)

9 : Infrared # 1 (Video Stream: Y8 1280x720@ 30Hz)

10 : Infrared # 2 (Video Stream: Y8 1280x720@ 30Hz)

11 : Infrared # 0 (Video Stream: BGRA8 1280x720@ 30Hz)

12 : Infrared # 0 (Video Stream: RGBA8 1280x720@ 30Hz)

13 : Infrared # 0 (Video Stream: BGR8 1280x720@ 30Hz)

14 : Infrared # 0 (Video Stream: RGB8 1280x720@ 30Hz)

15 : Infrared # 0 (Video Stream: UYVY 1280x720@ 15Hz)

16 : Infrared # 1 (Video Stream: Y8 1280x720@ 15Hz)

17 : Infrared # 2 (Video Stream: Y8 1280x720@ 15Hz)

18 : Infrared # 0 (Video Stream: BGRA8 1280x720@ 15Hz)

19 : Infrared # 0 (Video Stream: RGBA8 1280x720@ 15Hz)

20 : Infrared # 0 (Video Stream: BGR8 1280x720@ 15Hz)

21 : Infrared # 0 (Video Stream: RGB8 1280x720@ 15Hz)

22 : Infrared # 0 (Video Stream: UYVY 1280x720@ 6Hz)

23 : Infrared # 2 (Video Stream: Y8 1280x720@ 6Hz)

24 : Infrared # 1 (Video Stream: Y8 1280x720@ 6Hz)

25 : Infrared # 0 (Video Stream: BGRA8 1280x720@ 6Hz)

26 : Infrared # 0 (Video Stream: RGBA8 1280x720@ 6Hz)

27 : Infrared # 0 (Video Stream: BGR8 1280x720@ 6Hz)

28 : Infrared # 0 (Video Stream: RGB8 1280x720@ 6Hz)

29 : Infrared # 2 (Video Stream: Y16 960x540@ 25Hz)

30 : Infrared # 1 (Video Stream: Y16 960x540@ 25Hz)

31 : Infrared # 1 (Video Stream: Y16 960x540@ 15Hz)

32 : Infrared # 2 (Video Stream: Y16 960x540@ 15Hz)

33 : Infrared # 0 (Video Stream: UYVY 848x480@ 90Hz)

34 : Infrared # 1 (Video Stream: Y8 848x480@ 90Hz)

35 : Infrared # 2 (Video Stream: Y8 848x480@ 90Hz)

36 : Infrared # 0 (Video Stream: BGRA8 848x480@ 90Hz)

37 : Infrared # 0 (Video Stream: RGBA8 848x480@ 90Hz)

38 : Infrared # 0 (Video Stream: BGR8 848x480@ 90Hz)

39 : Infrared # 0 (Video Stream: RGB8 848x480@ 90Hz)

40 : Infrared # 0 (Video Stream: UYVY 848x480@ 60Hz)

41 : Infrared # 2 (Video Stream: Y8 848x480@ 60Hz)

42 : Infrared # 1 (Video Stream: Y8 848x480@ 60Hz)

43 : Infrared # 0 (Video Stream: BGRA8 848x480@ 60Hz)

44 : Infrared # 0 (Video Stream: RGBA8 848x480@ 60Hz)

45 : Infrared # 0 (Video Stream: BGR8 848x480@ 60Hz)

46 : Infrared # 0 (Video Stream: RGB8 848x480@ 60Hz)

47 : Infrared # 0 (Video Stream: UYVY 848x480@ 30Hz)

48 : Infrared # 1 (Video Stream: Y8 848x480@ 30Hz)

49 : Infrared # 2 (Video Stream: Y8 848x480@ 30Hz)

50 : Infrared # 0 (Video Stream: BGRA8 848x480@ 30Hz)

51 : Infrared # 0 (Video Stream: RGBA8 848x480@ 30Hz)

52 : Infrared # 0 (Video Stream: BGR8 848x480@ 30Hz)

53 : Infrared # 0 (Video Stream: RGB8 848x480@ 30Hz)

54 : Infrared # 0 (Video Stream: UYVY 848x480@ 15Hz)

55 : Infrared # 1 (Video Stream: Y8 848x480@ 15Hz)

56 : Infrared # 2 (Video Stream: Y8 848x480@ 15Hz)

57 : Infrared # 0 (Video Stream: BGRA8 848x480@ 15Hz)

58 : Infrared # 0 (Video Stream: RGBA8 848x480@ 15Hz)

59 : Infrared # 0 (Video Stream: BGR8 848x480@ 15Hz)

60 : Infrared # 0 (Video Stream: RGB8 848x480@ 15Hz)

61 : Infrared # 0 (Video Stream: UYVY 848x480@ 6Hz)

62 : Infrared # 1 (Video Stream: Y8 848x480@ 6Hz)

63 : Infrared # 2 (Video Stream: Y8 848x480@ 6Hz)

64 : Infrared # 0 (Video Stream: BGRA8 848x480@ 6Hz)

65 : Infrared # 0 (Video Stream: RGBA8 848x480@ 6Hz)

66 : Infrared # 0 (Video Stream: BGR8 848x480@ 6Hz)

67 : Infrared # 0 (Video Stream: RGB8 848x480@ 6Hz)

68 : Infrared # 0 (Video Stream: UYVY 640x480@ 90Hz)

69 : Infrared # 1 (Video Stream: Y8 640x480@ 90Hz)

70 : Infrared # 2 (Video Stream: Y8 640x480@ 90Hz)

71 : Infrared # 0 (Video Stream: BGRA8 640x480@ 90Hz)

72 : Infrared # 0 (Video Stream: RGBA8 640x480@ 90Hz)

73 : Infrared # 0 (Video Stream: BGR8 640x480@ 90Hz)

74 : Infrared # 0 (Video Stream: RGB8 640x480@ 90Hz)

75 : Infrared # 0 (Video Stream: UYVY 640x480@ 60Hz)

76 : Infrared # 2 (Video Stream: Y8 640x480@ 60Hz)

77 : Infrared # 1 (Video Stream: Y8 640x480@ 60Hz)

78 : Infrared # 0 (Video Stream: BGRA8 640x480@ 60Hz)

79 : Infrared # 0 (Video Stream: RGBA8 640x480@ 60Hz)

80 : Infrared # 0 (Video Stream: BGR8 640x480@ 60Hz)

81 : Infrared # 0 (Video Stream: RGB8 640x480@ 60Hz)

82 : Infrared # 0 (Video Stream: UYVY 640x480@ 30Hz)

83 : Infrared # 2 (Video Stream: Y8 640x480@ 30Hz)

84 : Infrared # 1 (Video Stream: Y8 640x480@ 30Hz)

85 : Infrared # 0 (Video Stream: BGRA8 640x480@ 30Hz)

86 : Infrared # 0 (Video Stream: RGBA8 640x480@ 30Hz)

87 : Infrared # 0 (Video Stream: BGR8 640x480@ 30Hz)

88 : Infrared # 0 (Video Stream: RGB8 640x480@ 30Hz)

89 : Infrared # 0 (Video Stream: UYVY 640x480@ 15Hz)

90 : Infrared # 1 (Video Stream: Y8 640x480@ 15Hz)

91 : Infrared # 2 (Video Stream: Y8 640x480@ 15Hz)

92 : Infrared # 0 (Video Stream: BGRA8 640x480@ 15Hz)

93 : Infrared # 0 (Video Stream: RGBA8 640x480@ 15Hz)

94 : Infrared # 0 (Video Stream: BGR8 640x480@ 15Hz)

95 : Infrared # 0 (Video Stream: RGB8 640x480@ 15Hz)

96 : Infrared # 0 (Video Stream: UYVY 640x480@ 6Hz)

97 : Infrared # 1 (Video Stream: Y8 640x480@ 6Hz)

98 : Infrared # 2 (Video Stream: Y8 640x480@ 6Hz)

99 : Infrared # 0 (Video Stream: BGRA8 640x480@ 6Hz)

100: Infrared # 0 (Video Stream: RGBA8 640x480@ 6Hz)

101: Infrared # 0 (Video Stream: BGR8 640x480@ 6Hz)

102: Infrared # 0 (Video Stream: RGB8 640x480@ 6Hz)

103: Infrared # 0 (Video Stream: UYVY 640x360@ 90Hz)

104: Infrared # 2 (Video Stream: Y8 640x360@ 90Hz)

105: Infrared # 1 (Video Stream: Y8 640x360@ 90Hz)

106: Infrared # 0 (Video Stream: BGRA8 640x360@ 90Hz)

107: Infrared # 0 (Video Stream: RGBA8 640x360@ 90Hz)

108: Infrared # 0 (Video Stream: BGR8 640x360@ 90Hz)

109: Infrared # 0 (Video Stream: RGB8 640x360@ 90Hz)

110: Infrared # 0 (Video Stream: UYVY 640x360@ 60Hz)

111: Infrared # 1 (Video Stream: Y8 640x360@ 60Hz)

112: Infrared # 2 (Video Stream: Y8 640x360@ 60Hz)

113: Infrared # 0 (Video Stream: BGRA8 640x360@ ...

0 Kudos
idata
Employee
1,458 Views

Hello Harmonic,

 

 

Did the solution above resolve your problem?

 

 

Regards,

 

Jesus G.

 

Intel Customer Support
0 Kudos
Reply