目前我正在使用CIDetector来检测UIImage中的矩形.我正在做的建议方法是将坐标传递给过滤器以获取CIImage以放置所采用的UIImage.它看起来像这样:
func performRectangleDetection(image: UIKit.CIImage) -> UIKit.CIImage? {
var resultImage: UIKit.CIImage?
let detector:CIDetector = CIDetector(ofType: CIDetectorTypeRectangle, context: nil, options: [CIDetectorAccuracy : CIDetectorAccuracyHigh])
// Get the detections
let features = detector.featuresInImage(image)
for feature in features as! [CIRectangleFeature] {
resultImage = self.drawHighlightOverlayForPoints(image, topLeft: feature.topLeft, topRight: feature.topRight,
bottomLeft: feature.bottomLeft, bottomRight: feature.bottomRight)
}
return resultImage
}
func drawHighlightOverlayForPoints(image: UIKit.CIImage, topLeft: CGPoint, topRight: CGPoint,
bottomLeft: CGPoint, bottomRight: CGPoint) -> UIKit.CIImage {
var overlay = UIKit.CIImage(color: CIColor(red: 1.0, green: 0.55, blue: 0.0, alpha: 0.45))
overlay = overlay.imageByCroppingToRect(image.extent) …Run Code Online (Sandbox Code Playgroud) 我意识到在URL中,+符号表示空格,但是我需要保留加号。我怎样才能做到这一点?我的网址和代码如下:
http://www.example.com/path/test.php?test=2+2
<?php
$test = $_GET['test'];
echo $test;
?>
Run Code Online (Sandbox Code Playgroud)
打印出2 2