We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List displayBoxesAround(Size screen, {required bool isPotrait}) { if (yoloResults.isEmpty) return [];
// Calculate scaling factors based on image orientation double factorX, factorY, imgRatio, newWidth, newHeight; if (isPotrait) { factorX = screen.height / (imageHeight); imgRatio = imageWidth / imageHeight; newWidth = imageWidth * factorX; newHeight = newWidth / imgRatio; factorY = newHeight / (imageHeight); } else { // Handle landscape image factorX = screen.width / (imageWidth); imgRatio = imageWidth / imageHeight; newWidth = imageWidth * factorX; newHeight = newWidth / imgRatio; factorY = newHeight / (imageHeight); } // Calculate padding for centered positioning double paddingX = (screen.width - factorX * imageWidth) / 2; double paddingY = (screen.height - factorY * imageHeight) / 2; Color colorPick = const Color.fromARGB(255, 50, 233, 30); return yoloResults.map((result) { return Positioned( left: paddingX + result["box"][0] * factorX, top: paddingY + result["box"][1] * factorY, width: (result["box"][2] - result["box"][0]) * factorX, height: (result["box"][3] - result["box"][1]) * factorY, child: Container( decoration: BoxDecoration( borderRadius: const BorderRadius.all(Radius.circular(10.0)), border: Border.all(color: Colors.pink, width: 2.0), ), child: Text( "${result['tag']} ${(result['box'][4] * 100).toStringAsFixed(0)}%", style: TextStyle( background: Paint()..color = colorPick, color: Colors.white, fontSize: 18.0, ), ), ), ); }).toList();
}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
List displayBoxesAround(Size screen, {required bool isPotrait}) {
if (yoloResults.isEmpty) return [];
}
The text was updated successfully, but these errors were encountered: