cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Proposal to Increase Photo Resolution of Camera Widget on Hololens with View App

JH_10275801
5-Regular Member

Proposal to Increase Photo Resolution of Camera Widget on Hololens with View App

I propose an improvement to the Camera Widget on Hololens with the View App. Currently, the resolution of these photos is lower than that of the Hololens' native camera, which can negatively impact image recognition accuracy. As these photos will be used for AI-based image recognition, high resolution is essential. Therefore, I suggest increasing the resolution of the Camera Widget photos to match that of the Hololens' native camera. This improvement would greatly enhance the accuracy and effectiveness of the Camera Widget for image recognition purposes.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @JH_10275801 

I checked the status:

Help : https://support.ptc.com/help/vuforia/studio/en/#page/Studio_Help_Center%2FWidgetCamera.html%23wwID0EZOUQ

and Technical Support article saying: https://www.ptc.com/en/support/article/CS409445

Article was updated fro 9.15

Description

  • In HoloLen 2, the resolution of picture taken by using Camera Widget is 1920x1080, however, it is 3904x2196 if taking a picture by using HoloLens 2 itself.
  • Is it possible to increase the resolution of picture taken by using Camera Widget

Resolution

 

View solution in original post

15 REPLIES 15

Hi @JH_10275801 

I checked the status:

Help : https://support.ptc.com/help/vuforia/studio/en/#page/Studio_Help_Center%2FWidgetCamera.html%23wwID0EZOUQ

and Technical Support article saying: https://www.ptc.com/en/support/article/CS409445

Article was updated fro 9.15

Description

  • In HoloLen 2, the resolution of picture taken by using Camera Widget is 1920x1080, however, it is 3904x2196 if taking a picture by using HoloLens 2 itself.
  • Is it possible to increase the resolution of picture taken by using Camera Widget

Resolution

 

JH_10275801
5-Regular Member
(To:RolandRaytchev)

Hi Roland,

 

Thanks a lot!!😀

JH_10275801
5-Regular Member
(To:RolandRaytchev)

Hi @RolandRaytchev ,

 

May I know the release version and schedule?

the ticket VTS-1865 is the report of this enhancement to PTC R&D team /Prodcut Managment as enhancement. - means that your report is in the pipeline considered for further development /fixing. Currently there is no deadline known yet. When I have further informaiton or status of Jira ticket will change - I will notify this in this post

Hi @JH_10275801 

To this issue

Here there is further feedback from developer team what I want to provide here :

R&D confirmed that it works by using this code:

$scope.takeScreenie = function () {

  let props = {

    "withAugmentation": true,

    "imgWidth": 2880,

    "imgHeight": 1406

  };



  let successCb = function(result, params) {

    console.log("params: " + JSON.stringify(params));

    console.log("result: ", result);

  };


  tml3dRenderer.takeScreenshot(props, successCb, ()=>{});

}

the result is a base64 string that represents the image.

You can call this from a press with takeScreenie(); and from an application event with viewCtrl.takeScreenie();.

Please, let me know if you can achieve your requirement with this code. Thanks

 

JH_10275801
5-Regular Member
(To:RolandRaytchev)

Hello @RolandRaytchev ,

 

I have a question to ask:

 

I set the imgWidth and imgHeight to the maximum resolution of Hololens 2,

 

 

 

let props = {

      "withAugmentation": true,
 
      "imgWidth": 3904,
 
      "imgHeight": 2196
 
    };

 

 

 

But when I try to save the photo, I got an error message from the experience service:

Error [ERR_FR_MAX_BODY_LENGTH_EXCEEDED]: Request body larger than maxBodyLength limit

at RedirectableRequest.write (D:\ptc\studio-es\node_modules\follow-redirects\index.js:102:24)

at IncomingMessage.ondata (node:internal/streams/readable:766:22)

at IncomingMessage.emit (node:events:513:28)

at addChunk (node:internal/streams/readable:324:12)

at readableAddChunk (node:internal/streams/readable:297:9)

at Readable.push (node:internal/streams/readable:234:10)

at HTTPParser.parserOnBody (node:_http_common:131:24)

 

So I tried to set the value of maxBodyLength in index.js and it worked.

 

before:

function wrap(protocols) {
// Default settings
var exports = {
maxRedirects: 21,
maxBodyLength: 10 * 1024 * 1024,
};

 

after : 

function wrap(protocols) {
// Default settings
var exports = {
maxRedirects: 21,
maxBodyLength: Infinity,
};

 

May I know if there are any other issues with setting maxBodyLength to Infinity? Or do you have any better solution to this problem?

 

Thanks a lot!!

Hi @JH_10275801 ,

so far this   enhancement  for usage of high resolution was  in the latest version when this was  announced. Waht is your Experience Service Verision and HoloLens2 Vuforia View version. I wil check it then more detailed  with the ticket and respectively check on HL. But I see you used something what are not recommended from Dev team directly . 

Could you please, provide full information about your relevant code to the issue and the context of usage. I my self never used maxRedirects and maxBodyLength and therefore it needs to be clarifed wiht the dev team. I generally not every possible option that could be used  is also  supported so  possible we can get from dev team about this option more information. So I think the follwong points:

- we need to check if you version used is a old one and therfore no further option are required when software is updated properly

- if this is the only solution then ,yes it could be used by we need to discuss with R&D team if the avibiltiy to use higher resolution when setting the mentioned options  will not lead to other issue - example perfomance lost etc.

So thereofre I need the relevant code to check it and to discuss to R&D. Thanks 

JH_10275801
5-Regular Member
(To:RolandRaytchev)

Hi @RolandRaytchev ,

 

Experience Service version : v9.16.2

Hololens2 Vuforia View : v9.16 

let screenShotImage = "";

$scope.saveScreenshot = () => {
    var currentdate = new Date();
    var datetime = "" + currentdate.getFullYear() + (currentdate.getMonth() + 1) + currentdate.getDate() + currentdate.getHours() + currentdate.getMinutes() + currentdate.getSeconds();
    var imgpath = "/ScreenShot/" +  datetime + ".jpg";
        
    twx.app.fn.triggerDataService("My_File_Repository", "SaveImage", { 'path': imgpath, 'content': screenShotImage, 'retryFlag': true })
}

$scope.takeScreenie = function () {
    let props = {
      "withAugmentation": true,
      "imgWidth": 3904,
      "imgHeight": 2196
    };
    
    let successCb = function(result, params) {
      console.log("params: " + JSON.stringify(params));
      console.log("result: ", result);
      screenShotImage = result;
      $scope.saveScreenshot();
    };
  
    tml3dRenderer.takeScreenshot(props, successCb, ()=>{});    
}

 Thanks for your kindly help~

@JH_10275801 ,

thanks for the feedback. That code / or similar Is that I also use and will test it   tomorrow /today I do not have acces the HL/

But what I wanted to know is in which context you used :

So I tried to set the value of maxBodyLength in index.js and it worked.

 

before:

function wrap(protocols) {
// Default settings
var exports = {
maxRedirects: 21,
maxBodyLength: 10 * 1024 * 1024,
};

 

after : 

function wrap(protocols) {
// Default settings
var exports = {
maxRedirects: 21,
maxBodyLength: Infinity,
};

there is mentioed the index.js - is that a file from installation or any servers?- e.g. Experience Service - index.js is most used filename in many different systems and also - where did you get a hint to change this - it could be  possibly good info if I could read this as background information or respectively  point to this when I discuss with  dev team. Thanks

JH_10275801
5-Regular Member
(To:RolandRaytchev)

@RolandRaytchev 

 

Error [ERR_FR_MAX_BODY_LENGTH_EXCEEDED]: Request body larger than maxBodyLength limit

at RedirectableRequest.write (D:\ptc\studio-es\node_modules\follow-redirects\index.js:102:24)

 

this file is what I mentioned => \ptc\studio-es\node_modules\follow-redirects\index.js

 

Thanks.

Hi @JH_10275801 ,

tested today but have some further quesitons to your post/feedback.

So the code mentioned /is clear but I did not pay attention on the first time I looked on it/  it will do nothing with the data e.g. to save. So means the code will take picture and will do ... something what you need to know, to be  defined in further code.

For example take a picture on HL standard /not view/ will save the picture by default ...<FileExplorer Location>\Pictures\Camera Roll:

20240305_155900_HoloLens.jpg20240305_160844_HoloLens.jpg

But the code you mentioned will save it to variable data and nothing else, so it is important to know what are the actions later , because possibly this was relevant for the occuring of the issue your described

The left , first picture is that when is done by HoloLens 2 take picture in vuforia View. This command will save the picture as mentioned to the Camera Roll folder. The second picture on the right is also done by take Picture HoloLens 2 default called in View ,but there we can see the inside the picture another picture shown on 3DImage widget. So that was a picture what I did in Vuforia View  on Hololens 2 and set to the src property of the 3DImage widget.

I used 2 different buttons with 2 different /but similar impementations /prog code 

//==========================
$scope.takeScreenie = function () {

  let props = {
      "withAugmentation": true,
      "imgWidth": 3904,
      "imgHeight": 2196
    };
//==========================


  let successCb = function(result, params) {

    console.log("params: " + JSON.stringify(params));

    console.log("result: ", result);

$scope.setWidgetProp('3DImage-1','src','data&colon;image/jpeg;base64,'+result)
 $scope.$applyAsync();
  };
//++++++

  tml3dRenderer.takeScreenshot(props, successCb, ()=>{});

}
//==========================
//=================
$scope.takePicture= ()=>{ 
//---------------------------------------------------------------------------------------
var callbackfnc = function (pngBase64String, args) {
 $scope.setWidgetProp('3DImage-1','src',pngBase64String)
 $scope.$applyAsync();
  console.warn(pngBase64String)
};
//---------------------------------------------------------------------------------------
$scope.screenShotPar = function(augmentation) {
let params = { dataURL:true, withAugmentation:augmentation,"imgWidth": 2880,"imgHeight": 1406 }
  tml3dRenderer.takeScreenshot(params, callbackfnc, null);
  $scope.$applyAsync();

}
//---------------------------------------------------------------------------------------  
  
$scope.screenShotPar(true)
 
}
//====== utilities

the one creates a a picture with the higher resoluton 3904x2196:

20240305_162443_HoloLens.jpg

so the arrea on 3DImage widget (there are no properties for width and high set -so it follow the picture size) is much larger as in the other picture which was made with the 2880 x1406

So all both functions  are working on my HoloLens 2 device  when I took the picture and set it to a widget  URL source . I did not observerd any issues, at least I am not aware that there are any . So the question is what did you with the picture that you run in the issue.

On my device  Vuforia view /   "Hey, version" HL will answer with 9160.7473. What is your version/string returned by HL device ?

Thanks

BR

JH_10275801
5-Regular Member
(To:RolandRaytchev)

@RolandRaytchev 

 

Sorry for not being clear.
I wanted to store pictures in Thingworx Repository instead of the Hololens Camera Roll folder,so I called

twx.app.fn.triggerDataService("My_File_Repository", "SaveImage", { 'path': imgpath, 'content': screenShotImage, 'retryFlag': true })


The error I mentioned occurred when running [/Things/My_File_Repository/Services/SaveImage].

::ffff:10.192.101.52 - Administrator [2024-03-01T09:02:25.365Z] "GET /ExperienceService/content/projects/dev-arsop-spatial_v01-screenshot/app/resources/Uploaded/chevron_big_left.png HTTP/1.1" 304 - "-" "Vuforia View/916.0.7473.0 (HoloLens; Windows 10)" 4 ms 10.13.2.197:2019 - [2024-03-01T09:02:25.361Z] - ms - ms - ms - ms
An error occurred while proxying request [/Things/My_File_Repository/Services/SaveImage]:
Error [ERR_FR_MAX_BODY_LENGTH_EXCEEDED]: Request body larger than maxBodyLength limit
at RedirectableRequest.write (D:\ptc\studio-es\node_modules\follow-redirects\index.js:102:24)
at IncomingMessage.ondata (node:internal/streams/readable:766:22)
at IncomingMessage.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
at HTTPParser.parserOnBody (node:_http_common:131:24)


and I set maxBodyLength: Infinity in D:\ptc\studio-es\node_modules\follow-redirects\index.js

After setting it up, restarting the experience service will prevent the error from occurring again, and my pictures can be successfully stored in the Repository. I just want to know if there will be any performance or other issues if I set maxBodyLength to infinity?

 

Thanks a lot!

Hi @JH_10275801 ,

thanks for the clarificaiton!, I tested TWX service SaveImage ( with 3904 x 2196 ) with Experience Service on PTC cloud instance. I  could not directly idetify a significant performance lost when I tested   the instance with the mentioned setting of the maxBodyLength. So open a ticket to the R&D team Jira VTS-1910 requesting informaiton about if this setting is recommended for usage or there any concern or respectively alternative value should be suggested. I will inform you here  as soon as have feedback from the R&D team. Thanks

The developer look on it and here the R&D feedback to the issue:

They can certainly set it much higher, if its very high, it might be a problem more from security/denial of service attach if someone was able to attempt uploading extremely large files.  Some value in the middle should be fine, 50mb?
JH_10275801
5-Regular Member
(To:RolandRaytchev)

@RolandRaytchev 

Thank you for your help~!

Top Tags