Jump to content

BennieC

Members
  • Content Count

    30
  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. BennieC

    Error Message after Update to 11.2

    I have the same problem but still have a problem after removing the file. Compiler now can't find the AndroidManifest.xml in the location. How do I restore this.
  2. BennieC

    bitmap to jpeg compression

    Hi, I have been trying to compress bitmaps to jpegs into a database to save space. However, I cannot get the codec to perform the compression. My code looks as follows var NewBitmap: TBitmap; CodecParams : TBitmapCodecSaveParams; MS1 : TMemoryStream; Surf: TBitmapSurface; JpgQuality : TBitmapCodecSaveParams; code snippet JpgQuality.Quality := 100; MS1.Position := 0; Surf := TBitmapSurface.create; try Surf.assign(NewBitmap); // use the codec to save Surface to stream if not TBitmapCodecManager.SaveToStream( MS1, Surf, // '.jpg', JpgQuality) then // THIS DOES NOT WORK '.jpg') then // THIS DOES WORK BUT NO COMPRESSION (FORMAT MAY NOT EVEN BE JPEG) raise EBitmapSavingFailed.Create( 'Error saving Bitmap to jpg'); finally Surf.Free; end;
  3. BennieC

    Listview Programming

    I have now used frames and a vertscrollbox and indeed it works well. (Even struggled through the French way of doing it) I would like to use a flow layout and have inserted that into the scrollbox. This seems to work better than me calculating object position as I would have to do in the scrollbox. I do however have a problem with the flowlayout when anchored to the right of the scrollbox and have posted a separate question on that.
  4. BennieC

    TFlowLayout in TVertScrollbox

    I want to use the flowlayout (In a vertscrollbox) where the width can be varied when application changes size. The number of items will overflow to the bottom, hence the scrollbox. When using a flowlayout on its own (anchored to the right of the form), stretching the width results in a proper re-layout. However if it is in a scroll box (anchored to the right) it seems to miscalculate the width and allows objects to overflow to the right, but only when I anchor the flowlayout to the right of the scrollbox. If it is not anchored to the scrollbox it works correctly but of course does not stretch with the form. Does anyone have any ideas?
  5. BennieC

    Listview Programming

    Indeed, the list items will be created during run time. We have no dataset.
  6. BennieC

    Listview Programming

    Good day I am trying to build an application which requires me to display multiple images in groups with selectable sizes. The images consist of a bitmap and a text field. My idea is to put the image groups in a TListview (Which I hope can display horizontally) and then add these listview groups into a TFlowlayout to manage the screen layout. However, I simply do not get it right to create a TListview item programmatically to display the image. I have tried to create a TListItemImage as well as simply adding a TListViewItem but neither worked in that I could see anything on the screen. I am including my test code (Note it pulls images from a folder for testing). The commented out sections will probably indicate some of the experiments that I tried. I will probably also struggle to add the TListviews to the TFlowlayout. Some advice will be much appreciated. The idea is that the application will run on both Android mobile as well as desktops. prjFlowLO.dpr prjFlowLO.dproj uFlowLOMain.fmx uFlowLOMain.pas
  7. BennieC

    Returning lists from Python to Delphi

    @pyscripter I have used your structure but still Delphi insist on giving me strings instead of floating point values. Can I somehow force the variant conversion to take this as a float? I have tried to assign the variant to single variable but have no luck. Regards I have tried assigning the variant to a single but get no joy. What does work is if I convert it to a single. var ConfValue:variant := aRectItm.GetItem(classCnt); ConfSingle := strtofloat(ConfValue);
  8. BennieC

    Returning lists from Python to Delphi

    @pyscripter I have used your structure but still Delphi insist on giving me strings instead of floating point values. Can I somehow force the variant conversion to take this as a float? I have tried to assign the variant to single variable but have no luck. Regards
  9. BennieC

    Returning lists from Python to Delphi

    @pyscripter Thank you. Indeed the layerOutputs is a variant and I am using VarPyth. However, using your syntax I seem to have made progress. Could you please explain the syntax as I am not familiar with that. Also, how do I declare a variable in a loop using the inline var statement? Kind regards
  10. BennieC

    Returning lists from Python to Delphi

    @SwiftExpat Thanks for the response. Regarding the bottleneck , the processing is requires the parsing of 507 + 2028 (and possibly an additional 8000) items, each consisting of 41 values (Yolo output) This has to happen in less than 10ms in order to stay within real time, or as close to that as possible. Regarding the code - my current attempt looks as follows (It does get the correct values out but takes about 500ms) aRectItmStr := aRectList.GetItem(rectCnt); // Get a rect , should have 41 values // It looks like this is a single string // Remove unnecessary spaces, linefeeds and brackets // Some records have long spaces while containstext(aRectItmStr, ' ') do aRectItmStr := StringReplace(aRectItmStr, ' ', ' ', [rfReplaceAll]); // Repeat until only single spaces exist aRectItmStr := StringReplace(aRectItmStr, '[', '', [rfReplaceAll]); aRectItmStr := StringReplace(aRectItmStr, ']', '', [rfReplaceAll]); aRectItmStr := StringReplace(aRectItmStr, #$A, '', [rfReplaceAll]); // #=numerical code, $=Hexdecimal aListArray := aRectItmStr.Split([' ', '''']); for i := 0 to MIN(length(aListArray), 41)-1 do aRectItmVals := strtofloatdef(aListArray, 0.0); I know this is probably inefficient but it would help a lot if i can just read the items as a n array of float values. Kind regards
  11. BennieC

    Returning lists from Python to Delphi

    Thank you for this - it does seem to be the right way to go as my current string parsing is far too slow. However I have no idea how to use either of the two options. In the Buffer protocol, how do I return my result which seems to be a list of arrays. at present the return value is just the tuple which in Python looks like this: Name: layerOutputs Type: tuple Value: (array([[0.09, 0.03, 0.34...0.]]. dtype=float32), array([[0.06, 0.05, 0.67...0.]]. dtype=float32)) Currently this is just returned as a value with name layerOutputs, but Delphi sees this as a character string In the MemShare solution - how do I determine the memory position in Python and how do I determine the memory structure to use the binary representation. Are there any resources you can point me to as I am at a complete loss/
  12. Hi, I have a Delphi application that calls OpenCV via Python4Delphi. It returns a tuple of floating point values in Python. However when I return the tuple to Delphi I get a string variable. Is there a way to force the conversion to maintain the floating point values. I managed to parse the string list in Delphi into a floating point array but the application should be in real time so this is an unnecessary step. In Python In Delphi Regards
  13. BennieC

    Converting tuples into Delphi objects

    Apologies I solved the problem - just me being stupid. I misunderstood the GetItem method. All seems to be working now.
  14. BennieC

    Converting tuples into Delphi objects

    Thank you very much. The problem is that there are different arrays in the tuple and unless I can separate them I don't know how to convert the variants into Delphi variables. The lengths are not always as short as the sample and can indeed be very long. I was hoping to use something like aTmpvariant1 := myPlatTuple[0] aTmpvariant2 := myPlatTuple[1] etc, and then be able to individually decode these like aDelphiVal1 := aTmpvariant1[0], etc. but that does not work.
  15. I am struggling with getting my results into Delphi. I have used direct access to the Python function as shown in the screencopy and in fact receive the correct results in Delphi using Code insight as shown. But I have no success in actually accessing this tuple from Delphi There are three items in the tuple (which is declared as a variant), the first containing a list of arrays, the second an array and the third a list of values. How do I individually access these values in Delphi - some sample code will help as I can't find anything in the demos and my knowledge of variants is quite inadequate. Kind regards
×