-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
renamed container folder, WIP devcontainers
- Loading branch information
1 parent
9b7b324
commit 15596cd
Showing
36 changed files
with
195 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
FROM ubuntu:22.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive \ | ||
LANGUAGE=en_US:en \ | ||
LANG=en_US.UTF-8 \ | ||
LC_ALL=en_US.UTF-8 | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
sudo \ | ||
python3.10 \ | ||
dos2unix \ | ||
git \ | ||
python3-pip \ | ||
xauth \ | ||
apt-utils \ | ||
dialog \ | ||
libnss3-tools \ | ||
libx11-dev \ | ||
git \ | ||
xz-utils \ | ||
zip \ | ||
unzip \ | ||
&& apt clean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
COPY ./scripts /scripts | ||
|
||
RUN dos2unix /scripts/*.sh | ||
|
||
RUN /scripts/install-build-essential.sh | ||
RUN /scripts/install-cmake.sh | ||
RUN /scripts/install-ros2.sh | ||
|
||
ARG USERNAME=vscode | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
|
||
# Create and switch to user | ||
RUN groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME --shell /bin/bash \ | ||
&& echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME \ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME | ||
|
||
# Set the default user to vscode | ||
USER $USERNAME | ||
|
||
# Create workspace so that user own this directory | ||
RUN mkdir -p /home/$USERNAME/workspace | ||
WORKDIR /home/$USERNAME/workspace | ||
|
||
ENTRYPOINT ["/bin/bash"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "ROS2 Dev Container", | ||
"remoteUser": "vscode", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"args": { | ||
"USERNAME": "vscode", | ||
"USER_GID": "1000", | ||
"USER_UID": "1000" | ||
} | ||
}, | ||
// "image": "agrobotappliedai/devcontainers:ros2", | ||
"customizations":{ | ||
"settings": { | ||
"terminal.integrated.shell.linux": "bash" | ||
} | ||
}, | ||
"workspaceFolder": "/home/vscode/workspace", | ||
"workspaceMount": "source=.,target=/home/vscode/workspace,type=bind,consistency=cached", | ||
"mounts": [], | ||
"runArgs": [ | ||
"--net=host", | ||
"-it" | ||
// "--privileged" | ||
// "--display later" | ||
], | ||
"postCreateCommand": "bash -c 'echo source /opt/ros/humble/setup.bash >> ~/.bashrc && source /opt/ros/humble/setup.bash'" | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
echo 'installing build-essential' | ||
|
||
apt -y update && apt -y upgrade | ||
apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
software-properties-common \ | ||
apt-transport-https \ | ||
ca-certificates \ | ||
lsb-release \ | ||
pkg-config \ | ||
gnupg \ | ||
git \ | ||
gdb \ | ||
wget \ | ||
curl \ | ||
nano \ | ||
zip \ | ||
unzip \ | ||
time \ | ||
sshpass \ | ||
ssh-client | ||
apt-get clean | ||
rm -rf /var/lib/apt/lists/* | ||
gcc --version | ||
g++ --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
echo 'installing cmake' | ||
|
||
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null | ||
echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/kitware.list >/dev/null | ||
apt-get update | ||
rm /usr/share/keyrings/kitware-archive-keyring.gpg | ||
apt-get install -y --no-install-recommends kitware-archive-keyring | ||
apt-cache policy cmake | ||
apt-get install -y --no-install-recommends cmake | ||
rm -rf /var/lib/apt/lists/* | ||
apt-get clean | ||
cmake --version |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
|
||
echo 'installing ros2' | ||
|
||
locale-gen en_US en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 | ||
|
||
apt-get update | ||
apt-get install -y --no-install-recommends \ | ||
gnupg2 \ | ||
lsb-release \ | ||
ca-certificates \ | ||
locales \ | ||
software-properties-common \ | ||
|
||
add-apt-repository universe | ||
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg | ||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null | ||
apt-get update && apt upgrade -y | ||
apt install ros-humble-ros-base python3-argcomplete ros-dev-tools -y | ||
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc | ||
source /opt/ros/humble/setup.bash | ||
printenv | grep -i ROS | ||
|
||
apt-get install -y --no-install-recommends \ | ||
|
||
rm -rf /var/lib/apt/lists/* | ||
apt-get clean |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from ultralytics import YOLO | ||
import cv2 | ||
|
||
# Define ROI (Region of Interest) as (x_min, y_min, x_max, y_max) | ||
roi = (100, 100, 800, 800) | ||
roi_x1, roi_y1, roi_x2, roi_y2 = roi | ||
|
||
# Load the pre-trained YOLO model | ||
model = YOLO('C:/Users/ishaa/Coding Projects/ROS/models/maize/Maize.pt') | ||
|
||
# Load the image | ||
image = cv2.imread('C:/Users/ishaa/Coding Projects/ROS/assets/maize/IMG_1822_14.JPG') | ||
|
||
# Make predictions on the image | ||
results = model(image) | ||
result = results[0] | ||
|
||
print("Bounding boxes:") | ||
boxes = result.boxes.xyxy # xyxy format: [x_min, y_min, x_max, y_max] | ||
|
||
for box in boxes: | ||
print(box) | ||
x_min, y_min, x_max, y_max = box.tolist() | ||
|
||
if x_min >= roi_x1 and x_max <= roi_x2 and y_min >= roi_y1 and y_max <= roi_y2: | ||
print(1) | ||
|
||
cv2.rectangle(image, (int(x_min), int(y_min)), (int(x_max), int(y_max)), (0, 255, 0), 2) | ||
|
||
cv2.rectangle(image, (roi_x1, roi_y1), (roi_x2, roi_y2), (255, 0, 0), 2) | ||
|
||
cv2.imshow("Image with ROI", image) | ||
cv2.waitKey(0) | ||
cv2.destroyAllWindows() | ||
|
||
# scaling color filter bbox output -> can get cropped images from ultralytics API |