% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sharkDetectoR.R
\name{detect_image}
\alias{detect_image}
\title{Submit a single image for shark detection (YOLO) only}
\usage{
detect_image(
  image_path,
  threshold = 0.25,
  draw_boxes = FALSE,
  crop = FALSE,
  save_dir = "./"
)
}
\arguments{
\item{image_path}{Path to a local image file (JPEG/PNG).}

\item{threshold}{Numeric in [0,1] controlling YOLO‐confidence threshold. Default = 0.25.}

\item{draw_boxes}{Logical; if TRUE, the server will draw boxes and return an annotated image path.
If set, this function will also download that annotated image (base name only).}

\item{crop}{Logical; if TRUE, the server will return all cropped shark patches;
if set, this function downloads each patch (base names only).}

\item{save_dir}{Character; directory where downloaded images are saved. Default = `"./"`.
A subfolder `"images"` will be created under it if it does not already exist.}
}
\value{
A data frame with columns:
  \itemize{
    \item \code{xmin, ymin, xmax, ymax} – bounding‐box coordinates (numeric).
    \item \code{score}           – detection confidence (numeric).
    \item \code{label}           – character: `"shark"` for label==0.
    \item \code{annotated_image} – base name of downloaded annotated image, or NA.
    \item \code{cropped_images}  – list‐column of base names of downloaded cropped patches, or an empty character vector.
  }
}
\description{
Calls the Flask API endpoint `/detect_image` at \code{http://sharkpulse.cnre.vt.edu}.
Returns a data frame of all detected bounding boxes (xmin, ymin, xmax, ymax), detection score,
and class label (character: "shark" when label == 0). Optionally downloads annotated and/or
cropped images into \code{save_dir}/images. The returned filenames are base names only.
}
\examples{
\dontrun{
  df <- detect_image(
    image_path = "shark.jpg",
    threshold  = 0.5,
    draw_boxes = TRUE,
    crop       = TRUE,
    save_dir   = "./results/"
  )
  print(df)
}
}
